0.3.1 • Published 6 years ago

creative-code-toolkit v0.3.1

Weekly downloads
3
License
MIT
Repository
github
Last release
6 years ago

Creative Code Toolkit

This library is my personal collection of helper functions in creative coding, revolving around modulation, array functions, random numbers, etc.

Functions

mapRange(v, a, b, c, d)

Map v in range a, b to range c, d

ParamType
vNumber
aNumber
bNumber
cNumber
dNumber

sinMap(v, div, a, b)

Map the output sin(v / div) to the range a, b

ParamType
vNumber
divNumber
aNumber
bNumber

cosMap(v, div, a, b)

Map the output cos(v / div) to the range a, b

ParamType
vNumber
divNumber
aNumber
bNumber

wrapValue(v, m, M)

if v is greater than M or less than m, wrap the value around to stay in this range

ParamType
vNumber
mNumber
MNumber

deepArrayCopy(a)

Return a deep copy array a

ParamType
aArray.<any>

genArray(s)

Create an array of size s

ParamType
sNumber

get1dY(i, rowLength)

Get the Y component of a 1d array containing 2d data when the index is i

ParamType
iNumber
rowLengthNumber

get1dX(i, rowLength)

Get the X component of a 1d array containing 2d data when the index is i

ParamType
iNumber
rowLengthNumber

choose(a)

pick a random element from the array a

ParamType
aArray.<any>

rndB(a, b)

Random number in range a, b

ParamType
aNumber
bNumber

rndIntB(a, b)

Random integer in range a, b

ParamType
aNumber
bNumber

polute()

Polutes the global scope with unnamespaced functions

0.3.1

6 years ago

0.3.0

7 years ago

0.2.0

7 years ago

0.1.0

7 years ago

0.0.2

7 years ago

0.0.1

7 years ago