Skip to content

Instantly share code, notes, and snippets.

@pketh
Created February 7, 2019 22:03
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save pketh/9fdaf9a1d90ebfee09882b53c1f6424c to your computer and use it in GitHub Desktop.
dynamic static
# viewportWidth = window.innerWidth
# viewportHeight = window.innerHeight
# totalPixels = viewportWidth * viewportHeight
# staticPixels = Math.round(totalPixels * 0.05) # 5 percent static
# staticCanvas = undefined
# staticContext = undefined
# staticCanvasImage = undefined
# frames = Array.from(Array(24)) # 24 variations
window.onload = ->
viewportWidth = window.innerWidth
viewportHeight = window.innerHeight
# staticCanvas = document.getElementById('static')
# initStaticCanvasSize()
# staticContext = staticCanvas.getContext('2d')
# initStaticFrames()
window.onresize = ->
viewportWidth = window.innerWidth
viewportHeight = window.innerHeight
# initStaticCanvasSize()
# staticCanvas.clearRect(0,0, window.innerWidth, window.innerHeight)
# staticCanvas.putImageData(staticCanvasImage, 0, 0)
# initStaticFrames()
# static
# window.setInterval ->
# staticContext.clearRect(0,0, window.innerWidth, window.innerHeight)
# frame = _.sample frames
# frame.forEach (pixel) ->
# staticContext.fillStyle = pixel.color
# staticContext.fillRect(pixel.x, pixel.y, 1, 1)
# , 60
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment