From bdf7cd5ba853f93cedfb25f68fcbea4df15c5413 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Yaroslav=20de=20la=20Pe=C3=B1a=20Smirnov?= Date: Sat, 8 Jan 2022 05:30:31 +0300 Subject: DJ IBAH 2022 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Wow so much blur! З.Ы. заебал не давать спатб --- starfield/stars.js | 28 +++++++++++++++++++++++++++- 1 file changed, 27 insertions(+), 1 deletion(-) diff --git a/starfield/stars.js b/starfield/stars.js index 6d649f8..f9e8a12 100644 --- a/starfield/stars.js +++ b/starfield/stars.js @@ -53,6 +53,8 @@ function Particle(ix, iy, posz, rgb){ function warpLaunch(options={}){ /* >>> Some parameters <<< */ + var blur = 1.0; + var IBAH = 0; var max_particles = options.hasOwnProperty('max_particles') ? options['max_particles'] : 500; var speed = @@ -175,7 +177,21 @@ function warpLaunch(options={}){ requestedFrame = window.requestAnimationFrame(nextFrame); return; } - ctx.clearRect(0, 0, canvas.width, canvas.height); + //ctx.clearRect(0, 0, canvas.width, canvas.height); + if (IBAH === 1) { + blur -= 0.02; + if (blur <= 0.0) { + IBAH = 2; + } + } else if (IBAH === 2) { + blur += 0.03; + if (blur >= 1.0) { + IBAH = 0; + blur = 1.0; + } + } + ctx.fillStyle = "rgba(0, 0, 0," + blur + ")"; + ctx.fillRect(0, 0, canvas.width, canvas.height); // Decrease the distance from the screen of the star based // based on the speed for(let i = 0; i < max_particles; i++){ @@ -214,6 +230,16 @@ function warpLaunch(options={}){ if (interactive){ console.log("Interactivity is on, move the mouse wheel to control speed"); canvas.addEventListener("wheel", updateSpeed); + window.addEventListener('keypress', function(e){ + if (e.code == 'KeyQ') + blur += 0.1; + if (e.code == 'KeyE') + blur -= 0.1; + if (e.code == 'KeyW') { + IBAH = 1; + blur = 0.95; + } + }); } window.addEventListener("resize", resize); -- cgit v1.2.3