October 2018
Intermediate to advanced
500 pages
12h 40m
English
Let's cover some useful functions that we can refactor for use in later chapters:
'use strict';// A set of utility functions for /common operations across our // applicationconst utils = { // Find and return a DOM element given an ID getCanvas(id) { // ... }, // Given a canvas element, return the WebGL2 context getGLContext(canvas) { // ... }, // Given a canvas element, expand it to the size of the window // and ensure that it automatically resizes as the window changes autoResizeCanvas(canvas) ...