Functions for manipulating audio signals.
.hide()
.setBins( bins )
bins
:: integer (defaultx
)
.setCutoff( frequency )
frequency
:: float (defaultx
)
.setScale( amount )
amount
:: float (defaultx
)
.setSmooth( amount )
amount
:: float (defaultx
)
.show()
Functions for manipulating color.
.brightness( amount )
amount
:: float (default0.4
)
osc(20,0,2)
.brightness( ({time}) => Math.sin(time) )
.out(o0)
.contrast( amount )
amount
:: float (default1.6
)
Larger amount
value makes higher contrast.
// 20Hz oscillator with contrast interpolating between 0.0-5.0
osc(20).contrast( ({time}) => Math.sin(time) * 5 ).out(o0)
.color( r, g, b )
r
:: floatg
:: floatb
:: float
Colorize texture.
// 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( amount )
amount
:: float (default0.005
)
Shift HSV values.
// 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( amount )
amount
:: float (default1.0
)
Invert color.
solid(1,1,1).invert([0,1]).out(o0)
.luma( threshold, tolerance )
threshold
:: float (default0.5
)tolerance
:: float (default0.1
)
// 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( bins, gamma )
bins
:: float (default3.0
)gamma
:: float (default0.6
)
// 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( amount )
amount
:: float (default2.0
)
osc(10,0,1).saturate( ({time}) => Math.sin(time) * 10 ).out()
.shift( r, g, b, a )
r
:: float (default0.5
)g
:: float (default0.5
)b
:: float (default0.5
)a
:: float (default0.5
)
.thresh( threshold, tolerance )
threshold
:: float (default0.5
)tolerance
:: float (default0.04
)
// 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)
Functions for manipulating geometry.
.kaleid( nSides )
nSides
:: float (default4.0
)
Kaleidoscope effect with nSides
repetition.
osc(25,-0.1,0.5).kaleid(50).out(o0)
.pixelate( x, y )
pixelX
:: float (default20.0
)pixelY
:: float (default20.0
)
Pixelate texture with pixelX
segments and pixelY
segments.
// default
noise().pixelate(20,20).out(o0)
noise()
.mult(osc(10,0.25,1))
.scrollY(1,0.25)
.pixelate([100,40,20,70].fast(0.25))
.modulateRotate(src(o0).scale(0.5),0.125)
.diff(src(o0).rotate([-0.05,0.05].fast(0.125)))
.out(o0)
.repeat( repeatX, repeatY, offsetX, offsetY )
repeatX
:: float (default3.0
)repeatY
:: float (default3.0
)offsetX
:: float (default0.0
)offsetY
:: float (default0.0
)
// default
shape().repeat(3.0, 3.0, 0.0, 0.0).out()
// dogtooth factory
shape(1.25,0.5,0.25)
.repeat(3, 3)
.scale(2)
.repeat(5, 5, ({time}) => Math.sin(time), ({time}) => Math.sin(time/2))
.out(o0)
.repeatX( reps, offset )
reps
:: float (default3.0
)offset
:: float (default0.0
)
// default
shape().repeatX(3.0, 0.0).out()
osc(5,0,1)
.rotate(1.57)
.repeatX([1,2,5,10], ({time}) => Math.sin(time))
.out()
.repeatY( reps, offset )
reps
:: float (default3.0
)offset
:: float (default0.0
)
// default
shape().repeatY(3.0, 0.0).out()
osc(5,0,1)
.repeatY([1,2,5,10], ({time}) => Math.sin(time))
.out()
.rotate( angle, speed )
angle
:: float (default10.0
)speed
:: float (default0.0
)
Rotate texture.
osc(50).rotate( ({time}) => time%360 ).out(o0)
osc(10,1,1)
.rotate( ({time}) => time%360, ({time}) => Math.sin(time*0.1)*0.05 )
.out(o0)
.scale( size, xMult, yMult )
size
:: float (default1.5
)xMult
:: float (default1.0
)yMult
:: float (default1.0
)
Scale texture.
// default
shape().scale(1.5,1,1).out()
shape().scale(1.5,[0.25,0.5,0.75,1].fast(0.25),[3,2,1])
.invert([0,1].fast(0.25))
.kaleid(5)
.kaleid(12)
.scale( ({time})=>Math.sin(time/5)*0.5 )
.rotate(1,1)
.out(o0)
.scrollX( scrollX, speed )
scrollX
:: float (default0.5
)speed
:: float (default0.0
)
// default
osc(10,0,1).scrollX(0.5,0).out()
// x position
osc(10,0,1).scrollX([0,0.25,0.5,0.75,1].fast(4),0).out()
// scroll speed
gradient(1).scrollX(0, ({time}) => Math.sin(time*0.05)*0.05 ).out()
gradient(0.125)
.scrollX(0, ({time}) => Math.sin(time*0.05)*0.05 )
.scrollY(0, ({time}) => Math.sin(time*0.01)*-0.07 )
.pixelate([5,2,10],[15,8])
.scale(0.15)
.modulate(noise(1,0.25))
.out()
.scrollY( scrollY, speed )
scrollY
:: float (default0.5
)speed
:: float (default0.0
)
// default
osc(10,0,1).scrollY(0.5,0).out()
// y position
osc(10,0,1).scrollY([0,0.25,0.5,0.75,1].fast(4),0).out()
// scroll speed
gradient(1).scrollY(0, ({time}) => Math.sin(time*0.05)*0.05 ).out()
gradient(0.125)
.scrollX(0, ({time}) => Math.sin(time*0.05)*0.05 )
.scrollY(0, ({time}) => Math.sin(time*0.01)*-0.07 )
.pixelate([5,2,10],[15,8])
.scale(0.15)
.modulate(noise(1,0.25))
.out()
Useful variables that are defined globally, and can be used within functions as a parameter.
mouse
.x
:: x position of mouse.y
:: y position of mouse
Control the oscillator frequency with the mouse position:
osc(() => mouse.x).out(o0)
time
time
:: the current time
Control the oscillator using a sine wave based on the current time:
osc( ({time}) => Math.sin(time) ).out(o0)
Functions for describing modulations of sources.
- modulate
- modulateHue
- modulateKaleid
- modulatePixelate
- modulateRepeat
- modulateRepeatX
- modulateRepeatY
- modulateRotate
- modulateScale
- modulateScrollX
- modulateScrollY
.modulate( texture, amount )
texture
color
:: see colorvec4
src
:: seesrc
shape
:: seeshape
amount
:: float (default0.1
)
Modulate texture. More about modulation at: https://lumen-app.com/guide/modulation/
// chocolate whirlpool
voronoi()
.color(0.9,0.25,0.15)
.rotate(({time})=>(time%360)/2)
.modulate(osc(25,0.1,0.5)
.kaleid(50)
.scale(({time})=>Math.sin(time*1)*0.5+1)
.modulate(noise(0.6,0.5)),
0.5)
.out(o0)
.modulateHue( color, amount )
texture
color
:: see colorvec4
src
:: seesrc
shape
:: seeshape
amount
:: float (default1.0
)
Changes coordinates based on hue of second input. Based on:https://www.shadertoy.com/view/XtcSWM
.modulateKaleid( nSides )
texture
color
:: see colorvec4
src
:: seesrc
shape
:: seeshape
nSides
:: float (default4.0
)
See also: kaleid
.
osc(9,-0.1,0.1)
.modulateKaleid(osc(11,0.5,0),50)
.scale(0.1,0.3)
.modulate(noise(5,0.1))
.mult(solid(1,1,0.3))
.out(o0)
.modulatePixelate( multiple, offset )
texture
color
:: see colorvec4
src
:: seesrc
shape
:: seeshape
multiple
:: float (default10.0
)offset
:: float (default3.0
)
See also: pixelate
// what lies beneath
voronoi(10,1,5).brightness(()=>Math.random()*0.15)
.modulatePixelate(noise(25,0.5),100)
.out(o0)
.modulateRepeat( texture, repeatX, repeatY, offsetX, offsetY )
texture
color
:: see colorvec4
src
:: seesrc
shape
:: seeshape
repeatX
:: float (default3.0
)repeatY
:: float (default3.0
)offsetX
:: float (default0.5
)offsetY
:: float (default0.5
)
// default
shape(4,0.9)
.mult(osc(3,0.5,1))
.modulateRepeat(osc(10), 3.0, 3.0, 0.5, 0.5)
.out(o0)
.modulateRepeatX( texture, reps, offset )
texture
color
:: see colorvec4
src
:: seesrc
shape
:: seeshape
reps
:: float (default3.0
)offset
:: float (default0.5
)
// straight lines illusion
shape(4,0.9)
.mult(osc(4,0.25,1))
.modulateRepeatX(osc(10), 5.0, ({time}) => Math.sin(time) * 5)
.scale(1,0.5,0.05)
.out(o0)
.modulateRepeatY( texture, reps, offset )
texture
color
:: see colorvec4
src
:: seesrc
shape
:: seeshape
reps
:: float (default3.0
)offset
:: float (default0.5
)
// morphing grid
shape(4,0.9)
.mult(osc(4,0.25,1))
.modulateRepeatY(osc(10), 5.0, ({time}) => Math.sin(time) * 5)
.scale(1,0.5,0.05)
.out(o0)
.modulateRotate( texture, multiple, offset )
texture
color
:: see colorvec4
src
:: seesrc
shape
:: seeshape
multiple
:: float (default1.0
)offset
:: float (default0.0
)
See also: rotate
// wormhole
voronoi(100,3,5)
.modulateRotate(osc(1,0.5,0).kaleid(50).scale(0.5),15,0)
.mult(osc(50,-0.1,8).kaleid(9))
.out(o0)
.modulateScale( multiple, offset )
texture
color
:: see colorvec4
src
:: seesrc
shape
:: seeshape
multiple
:: float (default1.0
)offset
:: float (default1.0
)
See also: scale
// cosmic radiation
gradient(5).repeat(50,50).kaleid([3,5,7,9].fast(0.5))
.modulateScale(osc(4,-0.5,0).kaleid(50).scale(0.5),15,0)
.out(o0)
.modulateScrollX( multiple, scrollX, speed )
texture
color
:: see colorvec4
src
:: seesrc
shape
:: seeshape
scrollX
:: float (default0.5
)speed
:: float (default0.0
)
See also: scrollX
// default
voronoi(25,0,0)
.modulateScrollX(osc(10),0.5,0)
.out(o0)
// different scroll and speed
voronoi(25,0,0)
.modulateScrollX(osc(10),0.5,0.25)
.out(o0)
.modulateScrollY( multiple, scrollX, speed )
texture
color
:: see colorvec4
src
:: seesrc
shape
:: seeshape
scrollY
:: float (default0.5
)speed
:: float (default0.0
)
See also: scrollY
// default
voronoi(25,0,0)
.modulateScrollY(osc(10),0.5,0)
.out(o0)
// different scroll and speed
voronoi(25,0,0)
.modulateScrollY(osc(10),0.5,0.25)
.out(o0)
Functions for performing operations on sources.
.add( texture, amount )
texture
color
:: see colorvec4
src
:: seesrc
shape
:: seeshape
amount
:: float (default0.5
)
Add textures.
shape().scale(0.5).add(shape(4),[0,0.25,0.5,0.75,1]).out()
osc(9,0.1,1).add(osc(13,0.5,5)).out()
.blend( texture, amount )
texture
color
:: see colorvec4
src
:: seesrc
shape
:: seeshape
amount
:: float (default0.5
)
Blend textures.
shape().scale(0.5).blend(shape(4),[0,0.25,0.5,0.75,1]).out()
osc(9,0.1,1).blend(osc(13,0.5,5)).out()
.diff( texture )
texture
color
:: see colorvec4
src
:: seesrc
shape
:: seeshape
Return difference of textures.
osc(9,0.1,1).diff(osc(13,0.5,5)).out()
osc(1,1,2)
.diff(shape(6,1.1,0.01)
.scale(({time})=>Math.sin(time)*0.05 + 0.9)
.kaleid(15)
.rotate(({time})=>time%360))
.out()
.layer( texture )
texture
color
:: see colorvec4
src
:: seesrc
shape
:: seeshape
Overlay texture based on alpha value.
solid(1,0,0,1).layer(shape(4).color(0,1,0,({time})=>Math.sin(time*2))).out()
.mask( texture, reps, offset )
texture
color
:: see colorvec4
src
:: seesrc
shape
:: seeshape
reps
:: float (default3.0
)offset
:: float (default0.5
)
// default
gradient(5).mask(voronoi(),3,0.5).invert([0,1]).out()
// algae pulse
osc(10,-0.25,1).color(0,0,1).saturate(2).kaleid(50)
.mask(noise(25,2).modulateScale(noise(0.25,0.05)))
.modulateScale(osc(6,-0.5,2).kaleid(50))
.mult(osc(3,-0.25,2).kaleid(50))
.scale(0.5,0.5,0.75)
.out()
.mult( texture, amount )
texture
color
:: see colorvec4
src
:: seesrc
shape
:: seeshape
amount
:: float (default1.0
)
Multiply images and blend with the texture by amount
.
osc(9,0.1,2).mult(osc(13,0.5,5)).out()
Sources are elementary generators that output different types of visual content.
gradient( speed )
speed
:: float (defaultx
)
// gradient sequence at speeds of 1, 2 & 4
gradient([1,2,4]).out(o0)
noise( scale, offset )
scale
:: int (default10.0
)offset
:: float (default0.1
)
Generate Perlin noise.
// noise interpolating between different scales and offsets
noise( ({time}) => Math.sin(time/10)*50 , ({time}) => Math.sin(time/2)/500 )
.out(o0)
osc( frequency, sync, offset )
frequency
:: float (default60.0
)sync
:: float (default0.1
)offset
:: float (default0.0
)
// frequency
osc( [1,10,50,100,250,500].fast(2) ).out(o0)
// frequency 2
osc( ({time}) => Math.sin(time/10) * 100 ).out(o0)
// sync
osc( 10, [-10,-1,-0.1,0,0.1,1,10], 0 ).out(o0)
// offset
osc(10,0.1, ({time}) => Math.sin(time/10) * 100 ).out(o0)
.out( buffer )
buffer
osc
:o0
,o1
,o2
,o3
src
:s0
,s1
,s2
,s3
// output four oscillators to different buffers
// and then modulate them together
osc( [1,10,50,100,250,500].fast(2) ).kaleid(20).out(o0) // frequency
osc( ({time}) => Math.sin(time/10) * 100 ).kaleid(19).out(o1) // frequency 2
osc( 10, [-10,-1,-0.1,0,0.1,1,10], 0 ).kaleid(21).out(o2) // sync
osc(10,0.1, ({time}) => Math.sin(time/10) * 1 ) // offset
.modulate(o1,0.05)
.modulate(o2,0.05)
.modulate(o3,0.05)
.kaleid(20)
.add(noise(3,10))
.out(o3)
render(o3)
render( buffer )
buffer
: buffer (defaulto0
)
osc( [1,10,50,100,250,500].fast(2) ).out(o0) // frequency
osc( ({time}) => Math.sin(time/10) * 100 ).out(o1) // frequency 2
osc( 10, [-10,-1,-0.1,0,0.1,1,10], 0 ).out(o2) // sync
osc(10,0.1, ({time}) => Math.sin(time/10) * 100 ).out(o3) // offset
render(o0) // change to o1, o2, or o3
// see all four buffers at once
osc( [1,10,50,100,250,500].fast(2) ).out(o0) // frequency
osc( ({time}) => Math.sin(time/10) * 100 ).out(o1) // frequency 2
osc( 10, [-10,-1,-0.1,0,0.1,1,10], 0 ).out(o2) // sync
osc(10,0.1, ({time}) => Math.sin(time/10) * 100 ).out(o3) // offset
render()
shape( sides, radius, smoothing)
sides
:: int (default3.0
)radius
:: float (default0.3
)smoothing
:: float (default0.01
)
// inverting blurry circle
shape(100,0.01,1).invert(({time})=>Math.sin(time)*2).out(o0)
// a... rainbow ball?
shape(5,0.5,0.1).repeat(19,19)
.mult(osc(10,1,2))
.rotate( ({time}) => time%360 )
.scrollX(1,-0.25)
.mult(shape(15,0.3,0.01)
.rotate( ({time}) => time%360 )
.scrollX(1,-0.25))
.out(o0)
solid( r, g, b, a )
r
:: float (default0.0
)g
:: float (default0.0
)b
:: float (default0.0
)a
:: float (default1.0
)
// cycling through red, green and blue
solid([1,0,0],[0,1,0],[0,0,1],1).out(o0)
src( input )
input
:: input (examples:o0
,s1
)
See hydra-examples
repository
voronoi( scale, speed, blending )
scale
:: float (default5
)speed
:: float (default0.3
)blending
:: float (default0.3
)
Generate voronoi shapes.
// default
voronoi(5,0.3,0.3).out(o0)
// fireflies
voronoi(25,2,10).color(1,1,0).brightness(0.15).out(o0)
osc(
[80, 100, 200, 50], 1 )
)
.out(o0)
fast ( amount)
amount
:: float (defaultx
)
osc(
[80, 100, 200, 50].fast(0.2), 1 )
)
.out(o0)