MCPcopy Index your code
hub / github.com/codrops/RainEffect / updateDroplets

Function updateDroplets

src/raindrops.js:228–250  ·  view source on GitHub ↗
(timeScale)

Source from the content-addressed store, hash-verified

226 this.textureCleaningIterations=50;
227 },
228 updateDroplets(timeScale){
229 if(this.textureCleaningIterations>0){
230 this.textureCleaningIterations-=1*timeScale;
231 this.dropletsCtx.globalCompositeOperation="destination-out";
232 this.dropletsCtx.fillStyle="rgba(0,0,0,"+(0.05*timeScale)+")";
233 this.dropletsCtx.fillRect(0,0,
234 this.width*this.dropletsPixelDensity,this.height*this.dropletsPixelDensity);
235 }
236 if(this.options.raining){
237 this.dropletsCounter+=this.options.dropletsRate*timeScale*this.areaMultiplier;
238 times(this.dropletsCounter,(i)=>{
239 this.dropletsCounter--;
240 this.drawDroplet(
241 random(this.width/this.scale),
242 random(this.height/this.scale),
243 random(...this.options.dropletsSize,(n)=>{
244 return n*n;
245 })
246 )
247 });
248 }
249 this.ctx.drawImage(this.droplets,0,0,this.width,this.height);
250 },
251 updateDrops(timeScale){
252 let newDrops=[];
253

Callers

nothing calls this directly

Calls 2

randomFunction · 0.90
timesFunction · 0.70

Tested by

no test coverage detected