create-graphic
A simple function for drawing on a canvas element and receiving the result. Useful for programmatically-generated static graphics, WebGL textures (think particles) etc.
Install
npm install create-graphic
Use
; const graphic = ;
The draw
function will return the canvas context by default, but you can return anything to override this. The example below also demonstrates defining both width and height, and using the draw function context as the, um, context
when not using an arrow function.
; const graphic = ;