Skip to content

Latest commit

 

History

History
32 lines (22 loc) · 758 Bytes

Global Methods.md

File metadata and controls

32 lines (22 loc) · 758 Bytes

A collection of helper methods are available.

rgbToString(Array)

Creates Canvas2D compatible RGB strings from an Array of length 3

rgbToString([64, 224, 208]); // returns "rgb(64,244,208)"

rgbaToString(Array)

Creates Canvas2D compatible RGBA strings from an Array of length 4

rgbaToString([64, 224, 208, 255]); // returns "rgba(64,244,208,1)"

p5.Math.js

modV includes p5.Math.js which is a collection of math methods from Processing added onto the Math object.

  • Math.sq()
  • Math.constrain()
  • Math.degrees()
  • Math.mag()
  • Math.dist()
  • Math.lerp()
  • Math.norm()
  • Math.map()

Find out more about p5.Math.js here which includes links to the docs per function.