MCPcopy Create free account
hub / github.com/codrops/RainEffect / init

Function init

src/index3.js:45–86  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

43loadTextures();
44
45function init(){
46 canvas=document.querySelector('#container');
47
48 let dpi=window.devicePixelRatio;
49 canvas.width=window.innerWidth;
50 canvas.height=window.innerHeight;
51 canvas.style.width=window.innerWidth+"px";
52 canvas.style.height=window.innerHeight+"px";
53
54 raindrops=new Raindrops(
55 canvas.width,
56 canvas.height,
57 dpi,
58 dropAlpha,
59 dropColor,
60 {
61 minR:30,
62 maxR:60,
63 collisionRadiusIncrease:0.002,
64 dropletsRate:35,
65 dropletsSize:[3,7.5],
66 dropletsCleaningRadiusMultiplier:0.30,
67 }
68 );
69
70
71 textureFg = createCanvas(textureFgSize.width,textureFgSize.height);
72 textureFgCtx = textureFg.getContext('2d');
73 textureBg = createCanvas(textureBgSize.width,textureBgSize.height);
74 textureBgCtx = textureBg.getContext('2d');
75
76 generateTextures();
77
78 renderer = new RainRenderer(canvas, raindrops.canvas, textureFg, textureBg, null,{
79 brightness:1.1,
80 alphaMultiply:6,
81 alphaSubtract:3,
82 parallaxFg:40
83 });
84
85 setupEvents();
86}
87
88function setupEvents(){
89 updateTextures();

Callers 1

loadTexturesFunction · 0.70

Calls 3

createCanvasFunction · 0.70
generateTexturesFunction · 0.70
setupEventsFunction · 0.70

Tested by

no test coverage detected