This is designed to be used alongside the canvas-sketch toolset, but it is generic enough to work for various Node.js/Browser use cases.
You can require each module individually, and grab only the necessary functions.
const math = ;console;// 1
Or by using destructuring to grab only a select few functions:
const fract lerp = ;console;// 0.23console;// 25
random utility has been inspired by Unity3D, as well as other engines.
const random = ;console;// some random number between 0 (inclusive) and 1 (exclusive)// Create a seeded random generatorconst seeded = random;console;// some deterministic random numberconsole;// deterministically shuffles a copy of the array
The following modules have been implemented:
math- Math & interpolation utilities
random- A random number generator
color- RGB and HSL color utilities
geometry- Utilities for geometry & shapes
penplot- Utilities for working with pen plotters (e.g. AxiDraw)
shader- A full-screen GLSL shader utility
The following are planned but not yet implemented:
tween- Tweening, easing & animation utilities
And more to come...
Use npm to install.
npm install canvas-sketch-util --save
For full API documentation, see Documentation.
You can also see a few examples in ./test/examples.js.
MIT, see LICENSE.md for details.