UNPKG

@forbespro/lead-agent

Version:
2 lines (1 loc) 2.34 kB
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const q=require("react/jsx-runtime"),v=require("react"),x=require("three"),D=require("./index23.js"),j=require("./index24.js"),O=require("./index25.js");function C(t){const s=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(t){for(const n in t)if(n!=="default"){const c=Object.getOwnPropertyDescriptor(t,n);Object.defineProperty(s,n,c.get?c:{enumerable:!0,get:()=>t[n]})}}return s.default=t,Object.freeze(s)}const r=C(x),F=({size:t=40})=>{const s=v.useRef(null);return v.useEffect(()=>{if(!s.current)return;const n=new r.Scene,c=new r.PerspectiveCamera(75,1,.1,1e3),u=new r.WebGLRenderer({canvas:s.current,alpha:!0,antialias:!0,precision:"highp",powerPreference:"high-performance"});u.setPixelRatio(Math.min(window.devicePixelRatio,2)),u.setSize(t,t),c.position.z=2.2;const l=new D.EffectComposer(u);l.addPass(new j.RenderPass(n,c));const R=new O.AfterimagePass(.85);l.addPass(R);const h=new r.SphereGeometry(1,36,36),w=new r.MeshBasicMaterial({color:666974,transparent:!0,opacity:.1}),P=new r.Mesh(h,w);n.add(P);const d=[],p=[4886754,49919,26367];for(let e=0;e<11;e++){const i=new r.EllipseCurve(0,0,1,1,0,Math.PI*2,!1,Math.random()*Math.PI*3).getPoints(68),a=new r.BufferGeometry().setFromPoints(i),m=new r.LineBasicMaterial({color:p[e%p.length],transparent:!0,opacity:.8,linewidth:10}),o=new r.Line(a,m);o.rotation.x=Math.random()*Math.PI,o.rotation.y=Math.random()*Math.PI,o.userData.pulseSpeed=.003*(e+1),o.userData.rotationSpeed={x:.18*(e%3+1),y:.12*(e%3+1),z:.06*(e%3+1)},d.push(o),n.add(o)}let y=0;const g=e=>{const M=e-y;y=e;const i=M*.0022;P.rotation.y+=.6*i,d.forEach((a,m)=>{const o=Math.sin(e*a.userData.pulseSpeed)*.5+.5,f=1+o*2;a.rotation.x+=a.userData.rotationSpeed.x*i*f,a.rotation.y+=a.userData.rotationSpeed.y*i*f,a.rotation.z+=a.userData.rotationSpeed.z*i*f;const b=a.material;b.opacity=.4+o*.6;const S=new r.Color(p[m%p.length]);S.multiplyScalar(.8+o*.7),b.color=S}),l.render(),requestAnimationFrame(g)},E=requestAnimationFrame(g);return()=>{cancelAnimationFrame(E),l.dispose(),d.forEach(e=>{e.geometry.dispose(),e.material.dispose()}),h.dispose(),w.dispose(),u.dispose()}},[t]),q.jsx("canvas",{ref:s,className:"fpl-h-8 fpl-w-8 fpl-mr-2",style:{display:"block",width:t,height:t}})};exports.default=F;