Created
March 28, 2018 14:17
-
-
Save IagoLast/232b478ecdcfafe50047b9709267dd76 to your computer and use it in GitHub Desktop.
Torture your eyes
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
<html> | |
<head> | |
<style> | |
* { | |
box-sizing: border-box; | |
} | |
body { | |
margin: 0; | |
padding: 0; | |
} | |
#example { | |
width: 100vw; | |
height: 100vh; | |
border: 1px solid black; | |
} | |
</style> | |
</head> | |
<body> | |
<canvas id="example"></canvas> | |
<script> | |
function update() { | |
console.log('Update'); | |
gl.clearColor(Math.random(), Math.random(), Math.random(), 1); | |
gl.clear(gl.COLOR_BUFFER_BIT); | |
gl.viewport(0, 0, gl.drawingBufferWidth, gl.drawingBufferHeight); | |
gl.canvas.height = gl.canvas.clientHeight; | |
gl.canvas.width = gl.canvas.clientWidth; | |
window.requestAnimationFrame(update); | |
} | |
const canvas = document.getElementById('example'); | |
const gl = canvas.getContext('webgl'); | |
window.requestAnimationFrame(update); | |
</script> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment