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

Function init

src/index2.js:37–90  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

35loadTextures();
36
37function init(){
38 canvas=document.querySelector('#container');
39
40 let dpi=window.devicePixelRatio;
41
42 raindrops=new Raindrops(
43 canvas.width,
44 canvas.height,
45 1,
46 dropAlpha,
47 dropColor,
48 {
49 minR:20,
50 maxR:60,
51 rainChance:0.3,
52 rainLimit:10,
53 dropletsRate:0,
54 globalTimeScale:0.45,
55 trailRate:1.1,
56 dropFallMultiplier:0.2,
57 trailScaleRange:[0.2,0.35],
58 autoShrink:false,
59 spawnArea:[-0.3,0.3],
60 collisionRadius:0.45,
61 collisionRadiusIncrease:0,
62 collisionBoost:0.35,
63 collisionBoostMultiplier:0.025,
64 }
65 );
66
67 times(80,(i)=>{
68 raindrops.addDrop(
69 raindrops.createDrop({
70 x:random(canvas.width),
71 y:random(canvas.height),
72 r:random(10,20)
73 })
74 )
75 });
76 renderer = new RainRenderer(
77 canvas,
78 raindrops.canvas,
79 textureFgImage,
80 textureBgImage,
81 dropShine,
82 {
83 renderShadow:true,
84 minRefraction:150,
85 maxRefraction:512,
86 alphaMultiply:7,
87 alphaSubtract:3
88 }
89 );
90}

Callers 1

loadTexturesFunction · 0.70

Calls 2

randomFunction · 0.90
timesFunction · 0.70

Tested by

no test coverage detected