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

Function init

demo/js/index3.js:4112–4143  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

4110loadTextures();
4111
4112function init() {
4113 canvas = document.querySelector('#container');
4114
4115 var dpi = window.devicePixelRatio;
4116 canvas.width = window.innerWidth;
4117 canvas.height = window.innerHeight;
4118 canvas.style.width = window.innerWidth + "px";
4119 canvas.style.height = window.innerHeight + "px";
4120
4121 raindrops = new _raindrops2["default"](canvas.width, canvas.height, dpi, dropAlpha, dropColor);
4122 raindrops.minR = 30;
4123 raindrops.maxR = 60;
4124 raindrops.collisionRadiusIncrease = 0.005;
4125 raindrops.drizzle = 35;
4126 raindrops.drizzleSize = [3, 7.5];
4127 raindrops.drizzleCleaningRadiusMultiplier = 0.30;
4128
4129 textureFg = (0, _createCanvas2["default"])(textureFgSize.width, textureFgSize.height);
4130 textureFgCtx = textureFg.getContext('2d');
4131 textureBg = (0, _createCanvas2["default"])(textureBgSize.width, textureBgSize.height);
4132 textureBgCtx = textureBg.getContext('2d');
4133
4134 generateTextures();
4135
4136 renderer = new _rainRenderer2["default"](canvas, raindrops.canvas, textureFg, textureBg, null, {
4137 brightness: 1.1,
4138 alphaMultiply: 6,
4139 alphaSubtract: 3
4140 });
4141
4142 setupEvents();
4143}
4144
4145function setupEvents() {
4146 updateTextures();

Callers 1

loadTexturesFunction · 0.70

Calls 2

generateTexturesFunction · 0.70
setupEventsFunction · 0.70

Tested by

no test coverage detected