diff options
Diffstat (limited to 'client/index.js')
| -rw-r--r-- | client/index.js | 17 |
1 files changed, 11 insertions, 6 deletions
diff --git a/client/index.js b/client/index.js index a91b821..32ea27f 100644 --- a/client/index.js +++ b/client/index.js @@ -92,7 +92,7 @@ function move (e){ // ctx.beginPath() // ctx.arc( x*window.innerWidth, y*window.innerHeight, v*500, 0, Math.PI*2 ) // ctx.fill() - if ((count++ % 5) == 0) { + if ((count++ % 10) == 0) { ctx.save() ctx.translate(x*window.innerWidth, y*window.innerHeight) ctx.rotate(Math.random() - 0.5) @@ -131,19 +131,24 @@ function animate(t){ ctx.save() // 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.05 + Math.random()/10 - if ((count % 3) == 0) { ctx.fillRect(0, 0, w, h) } - + // ctx.fillStyle = 'rgba(255,255,255,0.2)' // + [n,n,n] + ')' + + if (! drawing) { + ctx.globalAlpha = 0.05 + Math.random()/10 + if ((count % 3) == 0) { ctx.clearRect(0, 0, w, h) } + } + const w = canvas.width const h = canvas.height ctx.save() ctx.translate(w/2,h/2) ctx.rotate(mouse.x) ctx.translate(-w/2,-h/2) + ctx.globalAlpha = 0.01 ctx.drawImage(canvas, -2, -2, w+10, h+10) ctx.restore() - ctx.fillStyle='#fff' + ctx.globalAlpha = drawing ? (0.05 + Math.random()*0.05) : 0.1 + ctx.fillStyle='rgb(255,255,255)' ctx.fillRect(0, 0, w, h) ctx.restore() } |
