Color
Functions for manipulating color.
brightness
.brightness( amount )
amount
:: float (default0.4
)
Example
osc(20,0,2)
.brightness( ({time}) => Math.sin(time) )
.out(o0)
contrast
.contrast( amount )
amount
:: float (default1.6
)
Larger amount
value makes higher contrast.
Example
// 20Hz oscillator with contrast interpolating between 0.0-5.0
osc(20).contrast( ({time}) => Math.sin(time) * 5 ).out(o0)
color vec4
.color( r, g, b )
r
:: floatg
:: floatb
:: float
Colorize texture.
Example
// 20Hz oscillator source
// color sequence of Red, Green, Blue, White, Black
// output to buffer o0
osc(20).color([1,0,0,1,0],[0,1,0,1,0],[0,0,1,1,0]).out(o0)
colorama
.colorama( amount )
amount
:: float (default0.005
)
Shift HSV values.
Example
// 20Hz oscillator source
// color sequence of Red, Green, Blue, White, Black
// colorama sequence of 0.005, 0.5, 1.0 at 1/8 speed
// output to buffer o0
osc(20)
.color([1,0,0,1,0],[0,1,0,1,0],[0,0,1,1,0])
.colorama([0.005,0.33,0.66,1.0].fast(0.125))
.out(o0)
//
noise(3,0.1).colorama( ({time}) => Math.sin(time/5) ).out(o0)
invert
.invert( amount )
amount
:: float (default1.0
)
Invert color.
Example
solid(1,1,1).invert([0,1]).out(o0)
luma
.luma( threshold, tolerance )
threshold
:: float (default0.5
)tolerance
:: float (default0.1
)
Example
// default
osc(10,0,1).luma(0.5,0.1).out(o0)
osc(10,0,[0,0.5,1,2]).luma([0.1,0.25,0.75,1].fast(0.25),0.1).out(o0)
posterize
.posterize( bins, gamma )
bins
:: float (default3.0
)gamma
:: float (default0.6
)
Example
// static gradient posterized, varying bins
gradient(0).posterize( [1, 5, 15, 30] , 0.5 ).out(o0)
// static gradient posterized, varying gamma
gradient(0).posterize( 3, [0.1, 0.5, 1.0, 2.0] ).out(o0)
saturate
.saturate( amount )
amount
:: float (default2.0
)
Example
osc(10,0,1).saturate( ({time}) => Math.sin(time) * 10 ).out()
shift
.shift( r, g, b, a )
r
:: float (default0.5
)g
:: float (default0.5
)b
:: float (default0.5
)a
:: float (default0.5
)
Example
thresh
.thresh( threshold, tolerance )
threshold
:: float (default0.5
)tolerance
:: float (default0.04
)
Example
// default
noise(3,0.1).thresh(0.5,0.04).out(o0)
noise(3,0.1)
.thresh( ({time})=>Math.sin(time/2) , [0.04,0.25,0.75,1].fast(0.25) )
.out(o0)