Created
October 15, 2018 05:54
-
-
Save hajimehoshi/f2a5b15ca430805fd3a9dbbafdee920d to your computer and use it in GitHub Desktop.
This file contains 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
<!DOCTYPE html> | |
<canvas id="canvas" width="512" height="512"></canvas> | |
<script> | |
window.addEventListener('load', () => { | |
const canvas = document.getElementById('canvas'); | |
const gl = canvas.getContext('webgl'); | |
gl.viewport(0, 0, 512, 512); | |
var i = 0; | |
let f = () => { | |
setTimeout(() => { | |
i++ | |
const c = (i % 64) / 64 | |
gl.clearColor(c, c, c, 1); | |
gl.clear(gl.COLOR_BUFFER_BIT); | |
requestAnimationFrame(f); | |
}, 0); | |
}; | |
f(); | |
}); | |
</script> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment