{"version":3,"file":"Particle_dust_effect.wTNDgOgV.mjs","names":["useRef"],"sources":["https:/framerusercontent.com/modules/wfUqrSblXFjg2uhDLqgZ/pNcZqkoRK3j8FGPhqaG2/Particle_dust_effect.js"],"sourcesContent":["import{jsx as _jsx}from\"react/jsx-runtime\";import{useEffect,useRef}from\"react\";import{addPropertyControls,ControlType}from\"framer\";function createParticle(width,height,speed,minSize,maxSize){return{x:Math.random()*width,y:Math.random()*height,size:Math.random()*(maxSize-minSize)+minSize,speedX:(Math.random()-.5)*speed,speedY:(Math.random()-.5)*speed,opacity:Math.random()*.6+.2,opacitySpeed:(Math.random()-.5)*.005,twinklePhase:0,twinkleTimer:Math.random()*400+100,twinklePeak:0};}function hexToRgb(hex){const result=/^#?([a-f\\d]{2})([a-f\\d]{2})([a-f\\d]{2})$/i.exec(hex);return result?{r:parseInt(result[1],16),g:parseInt(result[2],16),b:parseInt(result[3],16)}:{r:255,g:255,b:255};}export default function DustParticles({particleCount=40,speed=.3,minSize=.5,maxSize=2.5,glow=0,glowColor=\"#ffffff\",particleColor=\"#ffffff\",opacity=1,twinkle=true,twinkleSpeed=5,twinkleIntensity=6}){const canvasRef=useRef(null);const propsRef=useRef({glow,glowColor,particleColor,opacity,twinkle,twinkleSpeed,twinkleIntensity});propsRef.current={glow,glowColor,particleColor,opacity,twinkle,twinkleSpeed,twinkleIntensity};useEffect(()=>{const canvas=canvasRef.current;if(!canvas)return;const ctx=canvas.getContext(\"2d\");if(!ctx)return;let animationId;function resize(){canvas.width=canvas.offsetWidth*2;canvas.height=canvas.offsetHeight*2;ctx.setTransform(2,0,0,2,0,0);}resize();const w=canvas.offsetWidth;const h=canvas.offsetHeight;const particles=Array.from({length:particleCount},()=>createParticle(w,h,speed,minSize,maxSize));function animate(){const w=canvas.offsetWidth;const h=canvas.offsetHeight;const{glow,glowColor,particleColor,opacity,twinkle,twinkleSpeed,twinkleIntensity}=propsRef.current;const rgb=hexToRgb(particleColor);const glowRgb=hexToRgb(glowColor);ctx.clearRect(0,0,w,h);ctx.globalAlpha=opacity;for(const p of particles){p.x+=p.speedX;p.y+=p.speedY;p.opacity+=p.opacitySpeed;if(p.opacity<=.1||p.opacity>=.8){p.opacitySpeed*=-1;}if(p.x<0)p.x=w;if(p.x>w)p.x=0;if(p.y<0)p.y=h;if(p.y>h)p.y=0;// Twinkle logic\nlet twinkleGlow=0;if(twinkle){if(p.twinklePhase>0){// Currently twinkling — sine curve for smooth in/out\ntwinkleGlow=Math.sin(p.twinklePhase*Math.PI)*p.twinklePeak;p.twinklePhase+=.012*twinkleSpeed;if(p.twinklePhase>=1){p.twinklePhase=0;// Next twinkle in 2-8 seconds (frames)\np.twinkleTimer=Math.random()*300+120;}}else{p.twinkleTimer-=1;if(p.twinkleTimer<=0){p.twinklePhase=.01;p.twinklePeak=twinkleIntensity;}}}const totalGlow=glow+twinkleGlow;// Glow\nif(totalGlow>0){const radius=p.size+totalGlow*4;const gradient=ctx.createRadialGradient(p.x,p.y,0,p.x,p.y,radius);const glowOpacity=Math.min(p.opacity*.6+twinkleGlow*.08,1);gradient.addColorStop(0,`rgba(${glowRgb.r}, ${glowRgb.g}, ${glowRgb.b}, ${glowOpacity})`);gradient.addColorStop(1,`rgba(${glowRgb.r}, ${glowRgb.g}, ${glowRgb.b}, 0)`);ctx.beginPath();ctx.arc(p.x,p.y,radius,0,Math.PI*2);ctx.fillStyle=gradient;ctx.fill();}// Particle core\nconst coreOpacity=Math.min(p.opacity+twinkleGlow*.1,1);ctx.beginPath();ctx.arc(p.x,p.y,p.size,0,Math.PI*2);ctx.fillStyle=`rgba(${rgb.r}, ${rgb.g}, ${rgb.b}, ${coreOpacity})`;ctx.fill();}ctx.globalAlpha=1;animationId=requestAnimationFrame(animate);}animate();const observer=new ResizeObserver(resize);observer.observe(canvas);return()=>{cancelAnimationFrame(animationId);observer.disconnect();};},[particleCount,speed,minSize,maxSize]);return /*#__PURE__*/_jsx(\"canvas\",{ref:canvasRef,style:{width:\"100%\",height:\"100%\",position:\"absolute\",top:0,left:0,pointerEvents:\"none\"}});}addPropertyControls(DustParticles,{particleCount:{type:ControlType.Number,title:\"Particles\",defaultValue:40,min:5,max:200,step:1},speed:{type:ControlType.Number,title:\"Speed\",defaultValue:.3,min:.05,max:2,step:.05},minSize:{type:ControlType.Number,title:\"Min Size\",defaultValue:.5,min:.1,max:5,step:.1},maxSize:{type:ControlType.Number,title:\"Max Size\",defaultValue:2.5,min:.5,max:10,step:.1},glow:{type:ControlType.Number,title:\"Base Glow\",defaultValue:0,min:0,max:10,step:.5},glowColor:{type:ControlType.Color,title:\"Glow Color\",defaultValue:\"#ffffff\"},particleColor:{type:ControlType.Color,title:\"Color\",defaultValue:\"#ffffff\"},opacity:{type:ControlType.Number,title:\"Opacity\",defaultValue:1,min:0,max:1,step:.05},twinkle:{type:ControlType.Boolean,title:\"Twinkle\",defaultValue:true,enabledTitle:\"On\",disabledTitle:\"Off\"},twinkleSpeed:{type:ControlType.Number,title:\"Twinkle Speed\",defaultValue:5,min:1,max:15,step:.5,hidden:props=>!props.twinkle},twinkleIntensity:{type:ControlType.Number,title:\"Twinkle Intensity\",defaultValue:6,min:1,max:15,step:.5,hidden:props=>!props.twinkle}});\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"DustParticles\",\"slots\":[],\"annotations\":{\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./Particle_dust_effect.map"],"mappings":"iLAAmI,SAAS,EAAe,EAAM,EAAO,EAAM,EAAQ,EAAQ,CAAC,MAAM,CAAC,EAAE,KAAK,OAAO,EAAE,EAAM,EAAE,KAAK,OAAO,EAAE,EAAO,KAAK,KAAK,OAAO,GAAG,EAAQ,GAAS,EAAQ,QAAQ,KAAK,OAAO,EAAE,IAAI,EAAM,QAAQ,KAAK,OAAO,EAAE,IAAI,EAAM,QAAQ,KAAK,OAAO,EAAE,GAAG,GAAG,cAAc,KAAK,OAAO,EA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