summaryrefslogtreecommitdiff
path: root/client/index.js
diff options
context:
space:
mode:
authorJules Laplace <julescarbon@gmail.com>2017-06-26 15:21:38 +0200
committerJules Laplace <julescarbon@gmail.com>2017-06-26 15:21:38 +0200
commit34b6b40f2985658b5307b1b5b51655077cb12999 (patch)
tree0b49d9b493ad4f4b28fd58f66b817f76274f8903 /client/index.js
parentf8b3001c83714cfb5989f3cac615dd2972752445 (diff)
adjust
Diffstat (limited to 'client/index.js')
-rw-r--r--client/index.js17
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()
}