From 243aa85cf1daee5ba5d2cacdac8d187d648e9693 Mon Sep 17 00:00:00 2001 From: Jules Laplace Date: Mon, 26 Jun 2017 03:22:42 +0200 Subject: fading --- bundle.js | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) (limited to 'bundle.js') diff --git a/bundle.js b/bundle.js index c8b176a..bfddf1b 100644 --- a/bundle.js +++ b/bundle.js @@ -22639,7 +22639,7 @@ function mod(n, m) { } function firstTouch(f) { return function (e) { - return f(e.touches[0]); + return e.preventDefault && f(e.touches[0]); }; } @@ -22762,7 +22762,7 @@ function tick(time) { // let offsetIndex = clamp( Math.floor(mouse.y * offsets.length + Math.cos(time/20)), 0, offsets.length-1 ) inertialIntensity = Math.max(intensity, (intensity + inertialIntensity * (inertia - 1)) / inertia); console.log(inertialIntensity); - var offsetIntensity = 0.98 * inertialIntensity; + var offsetIntensity = 0.94 * inertialIntensity + 0.02; var offsetIndex = Math.floor(offsetIntensity * offsets.length + Math.cos(time)); var offset = Math.max((offsets[offsetIndex] || 0) * GRAIN_TIME + 0.25 * Math.sin(time * 17 / 7), 0); // console.log(offset, offsets[offsetIndex] * GRAIN_TIME, ( 0.25 * Math.cos(time*13/7))) @@ -22791,10 +22791,10 @@ function move(e) { if (drawing) { intensity = Math.min(0.999, intensity + v * 0.1); inertialIntensity = Math.min(0.999, intensity); - if (intensity == 0.999) intensity -= Math.random() * 0.45; - if (inertialIntensity == 0.999) inertialIntensity -= Math.random() * 0.35; - var gray = Math.floor((0, _util.clamp)(1 - 10 * v, 0, 1) * 255); - ctx.fillStyle = 'rgb(' + [gray, gray, gray] + ')'; + if (intensity == 0.999) intensity -= Math.random() * 0.4; + if (inertialIntensity == 0.999) inertialIntensity -= Math.random() * 0.3; + var gray = Math.floor((0, _util.clamp)(10 * v, 0, 1) * 127); + ctx.fillStyle = 'rgb(' + [gray, gray, gray * 2] + ')'; ctx.beginPath(); ctx.arc(x * window.innerWidth, y * window.innerHeight, v * 500, 0, Math.PI * 2); ctx.fill(); @@ -22823,8 +22823,12 @@ if (_util.browser.isMobile) { function animate() { requestAnimationFrame(animate); ctx.save(); - ctx.fillStyle = 'rgba(255,255,255,' + (1 - (intensity || 0.01)) + ')'; - ctx.globalAlpha = 0.001; + ctx.fillStyle = 'rgba(0,0,0,' + (1 - (intensity || 0.01)) + ')'; + ctx.globalAlpha = 0.4; + ctx.rotate(0.001); + ctx.drawImage(canvas, -2, -2, canvas.width + 4, canvas.height + 4); + ctx.rotate(-0.001); + ctx.globalAlpha = 0.05 * Math.random(); ctx.fillRect(0, 0, window.innerWidth, window.innerHeight); ctx.restore(); } -- cgit v1.2.3-70-g09d2