Created
March 23, 2017 00:57
-
-
Save benfletcher/7948f83a0b62079861f2d639bf8049f8 to your computer and use it in GitHub Desktop.
Temporal dithering
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var swatch = document.createElement('div'); | |
swatch.style.width = 500; | |
swatch.style.height = 500; | |
document.body.appendChild(swatch); | |
function turnRed() { | |
swatch.style.backgroundColor = 'red'; | |
requestAnimationFrame(turnBlue); | |
} | |
function turnBlue() { | |
swatch.style.backgroundColor = 'blue'; | |
requestAnimationFrame(turnRed); | |
} | |
requestAnimationFrame(turnRed); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment