| <!doctype html> |
| <!-- |
| Copyright 2016 The Chromium Authors. All rights reserved. |
| Use of this source code is governed by a BSD-style license that can be |
| found in the LICENSE file. |
| --> |
| <html style="height:100%"> |
| <head> |
| <style> |
| html, body { |
| margin: 0; |
| padding: 0; |
| } |
| </style> |
| </head> |
| <body style="height:100%"> |
| <canvas id="canvas" width="200" height="100"></canvas> |
| </body> |
| <script> |
| var canvas = document.querySelector('canvas'); |
| canvas.style.width ='100%'; |
| canvas.style.height='100%'; |
| canvas.width = canvas.offsetWidth; |
| canvas.height = canvas.offsetHeight; |
| var gl = canvas.getContext("webgl"); |
| gl.viewport(0, 0, gl.viewportWidth, gl.viewportHeight); |
| var rColor = 0; |
| |
| function animate() { |
| rColor = (rColor + 1) % 255; |
| gl.clearColor(rColor / 255, 0.0, 0.0, 1.0); |
| gl.clear(gl.COLOR_BUFFER_BIT); |
| window.requestAnimationFrame(animate); |
| } |
| window.onload = animate; |
| </script> |
| </html> |