import{d as m,r as p,j as v,aF as g,f as z,$ as _,o as y,_ as S}from"./BxiWQxwE.js";const x=m({__name:"snow-effect",props:{count:{default:50},speed:{default:.5},color:{default:"rgba(255,255,255,0.8)"},zIndex:{default:1e3},particleSize:{default:3}},setup(l){const a=l,t=p(null);let o=null,s=[];const r=e=>({x:Math.random()*e,y:-a.particleSize,size:Math.random()*a.particleSize+1,speed:Math.random()*a.speed*.5+.1}),h=e=>{s=Array.from({length:a.count},()=>r(e))},w=(e,n)=>{s.forEach((i,u)=>{i.x+=Math.sin(i.y*.01)*.5,i.y+=i.speed,i.y>n&&(s[u]=r(e))})},f=e=>{e.fillStyle=a.color,s.forEach(n=>{e.beginPath(),e.arc(n.x,n.y,n.size/2,0,Math.PI*2),e.fill()})},d=()=>{const e=t.value;if(!e)return;const n=e.getContext("2d");n&&(e.width=window.innerWidth,e.height=window.innerHeight,n.clearRect(0,0,e.width,e.height),w(e.width,e.height),f(n),o=requestAnimationFrame(d))},c=()=>{t.value&&(t.value.width=window.innerWidth,t.value.height=window.innerHeight)};return v(()=>{{const e=t.value;if(!e)return;e.width=window.innerWidth,e.height=window.innerHeight,h(e.width,e.height),o=requestAnimationFrame(d),window.addEventListener("resize",c)}}),g(()=>{o&&cancelAnimationFrame(o),window.removeEventListener("resize",c)}),(e,n)=>(y(),z("canvas",{ref_key:"snowCanvas",ref:t,class:"snow-effect-canvas",style:_({zIndex:e.zIndex})},null,4))}}),I=S(x,[["__scopeId","data-v-9e970e22"]]);export{I as default};
