Skip to content

Instantly share code, notes, and snippets.

@hajimehoshi
Created October 15, 2018 05:54
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 hajimehoshi/f2a5b15ca430805fd3a9dbbafdee920d to your computer and use it in GitHub Desktop.
Save hajimehoshi/f2a5b15ca430805fd3a9dbbafdee920d to your computer and use it in GitHub Desktop.
<!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