Skip to content

Instantly share code, notes, and snippets.

@GoToLoop
GoToLoop / PVector.js
Last active February 13, 2023 05:21
PVector Class Refactoring for PJS
//module.exports = function(options, undef) {
"use strict";
const TAU = 2 * Math.PI,
lerp = (start, stop, amt = 0) => +start + amt*(stop - start),
sq = n => n*n,
pjsCheck = obj => obj != null && 'noLoop' in obj,
argsErr = (mtd, len, min) => {
throw `Too few args passed to ${mtd}() [${len} < ${min}].`;
};