var createGL =var createLoop =// get a WebGL contextvar gl =var canvas = glcanvasdocumentbody// setup a retina-scaled canvasvar app =// start renderingappstart// on requestAnimationFrameapp// handle window resizeapp
See demo.es6 for a full demo.
app = createLoop(canvas[, opt])
parentelement to fit to, or a scaling function (default
scalescaling ratio for canvas (default 1)
These options are passed to canvas-fit.
Start and stop the render loop. Returns the
app for chaining.
fn is called with
dt parameter which is the delta time since last frame. Uses raf-loop.
Called when the
window has resized, after the canvas has been re-scaled according to its
A getter for the
[ width, height ] of the canvas without device scaling. This is the same as:
[ canvas.width / app.scale, canvas.height / app.scale ]
Getters/setters to change
scale at runtime. See canvas-fit for details.
MIT, see LICENSE.md for details.