{"version":3,"file":"FloatingParticles_1.mkUdaH43.mjs","names":["useRef","useMemo","p"],"sources":["https:/framerusercontent.com/modules/ttgD2xmJUjE4VktoKUGY/x1VlvhCbXIJRXWUUhN0R/FloatingParticles_1.js"],"sourcesContent":["// Floating particles that smoothly hover and move around - Optimized for performance\nimport{jsx as _jsx}from\"react/jsx-runtime\";import{useEffect,useRef,useMemo}from\"react\";import{addPropertyControls,ControlType,useIsStaticRenderer}from\"framer\";import{useInView}from\"framer-motion\";/**\n * @framerSupportedLayoutWidth fixed\n * @framerSupportedLayoutHeight fixed\n */export default function FloatingParticles(props){const{particleCount=20,particleSize=4,particleColor1=\"#FFFFFF\",particleColor2=\"#CCCCCC\",particleColor3=\"#999999\",speed=1,opacity=.8,blur=false}=props;const containerRef=useRef(null);const animationRef=useRef();const particlesRef=useRef([]);const dimensionsRef=useRef({width:400,height:300});const isStatic=useIsStaticRenderer();const isInView=useInView(containerRef,{once:false,amount:.1});// Generate static particles for SSR/static rendering\nconst staticParticles=useMemo(()=>{const colors=[particleColor1,particleColor2,particleColor3];const count=Math.min(particleCount,15);return Array.from({length:count},(_,i)=>({id:i,x:(i*47+23)%350,y:(i*31+17)%250,size:particleSize,opacity:opacity,color:colors[i%colors.length]}));},[particleCount,particleSize,particleColor1,particleColor2,particleColor3,opacity]);// Initialize particles\nuseEffect(()=>{if(isStatic||!containerRef.current)return;const colors=[particleColor1,particleColor2,particleColor3];const container=containerRef.current;const rect=container.getBoundingClientRect();dimensionsRef.current={width:rect.width,height:rect.height};// Clear existing particles\ncontainer.innerHTML=\"\";particlesRef.current=[];// Create particles\nconst particles=[];const fragment=document.createDocumentFragment();for(let i=0;i<particleCount;i++){const particle={id:i,x:Math.random()*rect.width,y:Math.random()*rect.height,vx:(Math.random()-.5)*speed*.5,vy:(Math.random()-.5)*speed*.5,size:particleSize+Math.random()*particleSize*.5,opacity:opacity*(.5+Math.random()*.5),color:colors[Math.floor(Math.random()*colors.length)],element:null};const el=document.createElement(\"div\");el.style.cssText=`\n                position: absolute;\n                width: ${particle.size}px;\n                height: ${particle.size}px;\n                background-color: ${particle.color};\n                border-radius: 50%;\n                opacity: ${particle.opacity};\n                will-change: transform, opacity;\n                transform: translate3d(${particle.x}px, ${particle.y}px, 0);\n                contain: strict;\n                ${blur?\"filter: blur(1px);\":\"\"}\n                pointer-events: none;\n            `;fragment.appendChild(el);particle.element=el;particles.push(particle);}container.appendChild(fragment);particlesRef.current=particles;return()=>{container.innerHTML=\"\";};},[particleCount,particleSize,particleColor1,particleColor2,particleColor3,speed,opacity,blur,isStatic]);// Animation loop - direct DOM manipulation, no React state updates\nuseEffect(()=>{if(isStatic||!isInView)return;const animate=()=>{const{width,height}=dimensionsRef.current;const particles=particlesRef.current;for(let i=0;i<particles.length;i++){const p=particles[i];if(!p.element)continue;let newX=p.x+p.vx*speed;let newY=p.y+p.vy*speed;// Bounce off edges\nif(newX<=0||newX>=width){p.vx=-p.vx+(Math.random()-.5)*.1;newX=Math.max(0,Math.min(width,newX));}if(newY<=0||newY>=height){p.vy=-p.vy+(Math.random()-.5)*.1;newY=Math.max(0,Math.min(height,newY));}// Add slight random movement\np.vx+=(Math.random()-.5)*.02;p.vy+=(Math.random()-.5)*.02;// Limit velocity\nconst maxVel=speed*.8;p.vx=Math.max(-maxVel,Math.min(maxVel,p.vx));p.vy=Math.max(-maxVel,Math.min(maxVel,p.vy));p.x=newX;p.y=newY;// Direct DOM update\np.element.style.transform=`translate3d(${newX}px, ${newY}px, 0)`;}animationRef.current=requestAnimationFrame(animate);};animationRef.current=requestAnimationFrame(animate);return()=>{if(animationRef.current){cancelAnimationFrame(animationRef.current);}};},[isStatic,isInView,speed]);// Handle resize\nuseEffect(()=>{if(isStatic)return;const handleResize=()=>{if(!containerRef.current)return;const rect=containerRef.current.getBoundingClientRect();dimensionsRef.current={width:rect.width,height:rect.height};};handleResize();window.addEventListener(\"resize\",handleResize,{passive:true});return()=>window.removeEventListener(\"resize\",handleResize);},[isStatic]);// Pause animation when not in view\nuseEffect(()=>{if(isStatic)return;if(!isInView&&animationRef.current){cancelAnimationFrame(animationRef.current);animationRef.current=undefined;}else if(isInView&&!animationRef.current&&particlesRef.current.length>0){const animate=()=>{const{width,height}=dimensionsRef.current;const particles=particlesRef.current;for(let i=0;i<particles.length;i++){const p=particles[i];if(!p.element)continue;let newX=p.x+p.vx*speed;let newY=p.y+p.vy*speed;if(newX<=0||newX>=width){p.vx=-p.vx+(Math.random()-.5)*.1;newX=Math.max(0,Math.min(width,newX));}if(newY<=0||newY>=height){p.vy=-p.vy+(Math.random()-.5)*.1;newY=Math.max(0,Math.min(height,newY));}p.vx+=(Math.random()-.5)*.02;p.vy+=(Math.random()-.5)*.02;const maxVel=speed*.8;p.vx=Math.max(-maxVel,Math.min(maxVel,p.vx));p.vy=Math.max(-maxVel,Math.min(maxVel,p.vy));p.x=newX;p.y=newY;p.element.style.transform=`translate3d(${newX}px, ${newY}px, 0)`;}animationRef.current=requestAnimationFrame(animate);};animationRef.current=requestAnimationFrame(animate);}},[isInView,isStatic,speed]);// Static render for SSR/Canvas\nif(isStatic){return /*#__PURE__*/_jsx(\"div\",{ref:containerRef,style:{width:\"100%\",height:\"100%\",position:\"relative\",overflow:\"hidden\",backgroundColor:\"transparent\",contain:\"strict\"},children:staticParticles.map(particle=>/*#__PURE__*/_jsx(\"div\",{style:{position:\"absolute\",left:particle.x,top:particle.y,width:particle.size,height:particle.size,backgroundColor:particle.color,borderRadius:\"50%\",opacity:particle.opacity,filter:blur?\"blur(1px)\":\"none\",willChange:\"transform\",pointerEvents:\"none\"}},particle.id))});}return /*#__PURE__*/_jsx(\"div\",{ref:containerRef,style:{width:\"100%\",height:\"100%\",position:\"relative\",overflow:\"hidden\",backgroundColor:\"transparent\",contain:\"strict\"}});}addPropertyControls(FloatingParticles,{particleCount:{type:ControlType.Number,title:\"Particle Count\",defaultValue:20,min:5,max:150,step:1},particleSize:{type:ControlType.Number,title:\"Particle Size\",defaultValue:4,min:1,max:20,step:1,unit:\"px\"},particleColor1:{type:ControlType.Color,title:\"Particle Color 1\",defaultValue:\"#FFFFFF\"},particleColor2:{type:ControlType.Color,title:\"Particle Color 2\",defaultValue:\"#CCCCCC\"},particleColor3:{type:ControlType.Color,title:\"Particle Color 3\",defaultValue:\"#999999\"},speed:{type:ControlType.Number,title:\"Speed\",defaultValue:1,min:.1,max:5,step:.1},opacity:{type:ControlType.Number,title:\"Opacity\",defaultValue:.8,min:.1,max:1,step:.1},blur:{type:ControlType.Boolean,title:\"Blur Effect\",defaultValue:false,enabledTitle:\"On\",disabledTitle:\"Off\"}});\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"FloatingParticles\",\"slots\":[],\"annotations\":{\"framerContractVersion\":\"1\",\"framerSupportedLayoutHeight\":\"fixed\",\"framerSupportedLayoutWidth\":\"fixed\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./FloatingParticles_1.map"],"mappings":"+PAIG,SAAwB,EAAkB,EAAM,CAAC,GAAK,CAAC,gBAAc,GAAG,eAAa,EAAE,iBAAe,UAAU,iBAAe,UAAU,iBAAe,UAAU,QAAM,EAAE,UAAQ,GAAG,OAAK,IAAO,EAAY,EAAaA,EAAO,KAAK,CAAO,EAAaA,GAAQ,CAAO,EAAaA,EAAO,EAAE,CAAC,CAAO,EAAcA,EAAO,CAAC,MAAM,IAAI,OAAO,IAAI,CAAC,CAAO,EAAS,GAAqB,CAAO,EAAS,EAAU,EAAa,CAAC,KAAK,GAAM,OAAO,GAAG,CAAC,CACnb,EAAgBC,MAAY,CAAC,IAAM,EAAO,CAAC,EAAe,EAAe,EAAe,CAAO,EAAM,KAAK,IAAI,EAAc,GAAG,CAAC,OAAO,MAAM,KAAK,CAAC,OAAO,EAAM,EAAE,EAAE,KAAK,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,IAAI,IAAI,GAAG,EAAE,GAAG,IAAI,IAAI,KAAK,EAAqB,UAAQ,MAAM,EA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