Skip to content

Instantly share code, notes, and snippets.

@zeffii
Created September 18, 2015 12:42
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save zeffii/f61b7587912728eb6861 to your computer and use it in GitHub Desktop.
Save zeffii/f61b7587912728eb6861 to your computer and use it in GitHub Desktop.
timerVar = {}
dw = document.documentElement.clientWidth
dh = document.documentElement.clientHeight
# window.clearInterval timerVar
time_unit = 0
Draw = (ctx) ->
ctx.fillStyle = 'rgba(255,155,135, 0.12)'
ctx.fillRect(0,0,600,200)
for i in [0..3]
for j in [0..3]
ctx.save()
ctx.fillStyle = 'rgb('+(51*i)+','+(255-51*i)+',255)'
ctx.translate(10+j*50,10+i*50)
ctx.fillRect(0,0,25+time_unit,25+time_unit)
ctx.restore()
time_unit += 1
time_unit = time_unit % 20
$(document).ready( () ->
ctx = $("canvas")[0].getContext('2d');
timerVar = setInterval((->
Draw(ctx)
return
), 20)
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment