diff options
Diffstat (limited to 'client/index.js')
| -rw-r--r-- | client/index.js | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/client/index.js b/client/index.js index 5091da7..a91b821 100644 --- a/client/index.js +++ b/client/index.js @@ -60,7 +60,7 @@ function tick (time) { let offsetIntensity = 0.94 * inertialIntensity + 0.02 let offsetIndex = Math.floor(offsetIntensity * offsets.length + Math.cos(time)) let offset = Math.max((offsets[offsetIndex] || 0) * GRAIN_TIME + ( 0.25 * Math.sin(time*17/7) ), 0) - player.start('applause', time, offset, GRAIN_TIME * 4, 0, inertialIntensity) + player.start('applause', time, offset, GRAIN_TIME * 4, 0, (inertialIntensity * 0.95) + 0.05) } let mouse = { x: window.innerWidth/2, y: window.innerHeight/2 } @@ -110,6 +110,9 @@ function up (e) { setInterval( () => { inertialIntensity += 0.001 }, 5000) +setInterval( () => { + if (! drawing) inertialIntensity += 0.01 * Math.random() +}, 15000) if (browser.isMobile) { document.body.addEventListener('touchstart', firstTouch(down)) @@ -129,8 +132,8 @@ function animate(t){ // ctx.fillStyle=color(inertialIntensity/2) const n = Math.floor( (0.5 + randrange(0, 1 - inertialIntensity/2) ) * 255 ) ctx.fillStyle = 'rgb(255,255,255)' // + [n,n,n] + ')' - ctx.globalAlpha = 0.02 - ctx.fillRect(0, 0, w, h) + ctx.globalAlpha = 0.05 + Math.random()/10 + if ((count % 3) == 0) { ctx.fillRect(0, 0, w, h) } const w = canvas.width const h = canvas.height |
