"use strict";(self.webpackChunkelement_web=self.webpackChunkelement_web||[]).push([[2792],{"./src/effects/snowfall/index.ts":(t,e,i)=>{i.d(e,{default:()=>c});var s=i("./node_modules/@babel/runtime/helpers/esm/defineProperty.js"),n=i("./src/utils/arrays.ts");function o(t,e){var i=Object.keys(t);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(t);e&&(s=s.filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})),i.push.apply(i,s)}return i}function r(t){for(var e=1;e{if(!t)return;this.context=t.getContext("2d"),this.particles=[];const i=this.options.maxCount;for(;this.particles.length{this.isRunning=!1}),(0,s.A)(this,"resetParticle",(t,e,i)=>(t.x=Math.random()*e,t.y=Math.random()*-i,t.xCol=t.x,t.diameter=7*Math.random()+4,t.maximumDrift=Math.random()*this.options.maxDrift+3.5,t.gravity=this.options.gravity+6*Math.random()+4,t)),(0,s.A)(this,"renderLoop",()=>{if(this.context&&this.context.canvas)if(0===this.particles.length)this.context.clearRect(0,0,this.context.canvas.width,this.context.canvas.height);else{(Date.now()-this.lastAnimationTime>=15||!this.lastAnimationTime)&&(this.context.clearRect(0,0,this.context.canvas.width,this.context.canvas.height),this.lastAnimationTime=Date.now(),this.animateAndRenderSnowflakes()),requestAnimationFrame(this.renderLoop)}}),this.options=r(r({},a),t)}animateAndRenderSnowflakes(){if(!this.context||!this.context.canvas)return;const t=this.context.canvas.height;for(const e of(0,n.PF)(this.particles)){e.y+=e.gravity;const i=75*e.maximumDrift,s=2*Math.PI;e.x=e.maximumDrift*Math.sin(s/i*e.y),e.x+=e.xCol;const n=e.diameter/2;this.context.save(),this.context.beginPath(),this.context.ellipse(e.x,e.y,n,n,0,0,360),this.context.fillStyle="#eaeaea",this.context.fill(),this.context.closePath(),this.context.restore();const o=4*n;if(e.y>t+o){const t=this.particles.indexOf(e);this.particles.splice(t,1)}}}}}}]); //# sourceMappingURL=2792.js.map