summaryrefslogtreecommitdiff
path: root/client/index.js
diff options
context:
space:
mode:
Diffstat (limited to 'client/index.js')
-rw-r--r--client/index.js23
1 files changed, 14 insertions, 9 deletions
diff --git a/client/index.js b/client/index.js
index 9b4c56e..4a86930 100644
--- a/client/index.js
+++ b/client/index.js
@@ -53,7 +53,7 @@ function tick (time) {
player.start('applause', time, offset, GRAIN_TIME * 4, 0, inertialIntensity)
}
-let mouse = { x: 0, y: 0 }
+let mouse = { x: window.innerWidth/2, y: window.innerHeight/2 }
let drawing = false
let canvas = document.createElement('canvas')
canvas.width = window.innerWidth
@@ -110,20 +110,25 @@ function animate(t){
ctx.save()
ctx.fillStyle=color(inertialIntensity/2)
ctx.globalAlpha = 0.4
- ctx.rotate(0.005)
- ctx.drawImage(canvas, -5, -5, canvas.width+10, canvas.height+10)
- ctx.rotate(-0.005)
- ctx.globalAlpha = 0.05 * Math.random()
- ctx.fillRect(0, 0, window.innerWidth, window.innerHeight)
- ctx.fillStyle='#fff'
- ctx.fillRect(0, 0, window.innerWidth, window.innerHeight)
+ 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.drawImage(canvas, -2, -2, w+10, h+10)
+ ctx.restore()
+ ctx.globalAlpha = 0.02 * Math.random()
+ ctx.fillRect(0, 0, w, h)
+ ctx.fillStyle='#000'
+ ctx.fillRect(0, 0, w, h)
ctx.restore()
}
animate()
load()
function load() {
- if (loading) setTimeout(load, 100)
+ if (loading) setTimeout(load, 10)
ctx.font = "100px " + choice(fonts)
ctx.fillStyle=color(Math.random())
ctx.fillText("LOADING!",window.innerWidth/2-250,window.innerHeight/2)