Files
hydra/docs/funcs.md
2019-03-20 11:04:42 +00:00

5.8 KiB

Functions

Categories

Contents


Audio

Functions for manipulating audio signals.

hide

.hide()

setBins

.setBins( bins )

  • bins :: integer (default x)

setCutoff

.setCutoff( frequency )

  • frequency :: float (default x)

setScale

.setScale( amount )

  • amount :: float (default x)

setSmooth

.setSmooth( amount )

  • amount :: float (default x)

show

.show()


Color

Functions for manipulating color.

contrast

.contrast( amount )

  • amount :: float (default 1.6)

Larger amount value makes higher contrast.

color vec4

.color( r, g, b )

  • r :: float
  • g :: float
  • b :: float

Colorize texture.

colorama

.colorama( amount )

  • amount :: float (default 0.005)

Shift HSV values.

invert

.invert( amount )

  • amount :: float (default 1.0)

Invert color.

luma

.luma( threshold, tolerance )

  • threshold :: float (default 0.5)
  • tolerance :: float (default 0.1)

thresh

.thresh( threshold, tolerance )

  • threshold :: float (default 0.5)
  • tolerance :: float (default 0.04)

Geometry

Functions for manipulating geometry.

kaleid

.kaleid( nSides )

  • nSides :: float (default 4.0)

Kaleidoscope effect with nSides repetition.

pixelate

.pixelate( x, y )

  • pixelX :: float (default 20.0)
  • pixelY :: float (default 20.0)

Pixelate texture with pixelX segments and pixelY segments.

rotate

.rotate( angle, speed )

  • angle :: float (default 10.0)
  • speed :: float (default 0.0)

Rotate texture.

scale

.scale( size, xMult, yMult )

  • size :: float (default x)
  • xMult :: float (default 1.0)
  • yMult :: float (default 1.0)

Scale texture.

scrollX

.scrollX( scrollX, speed )

  • scrollX :: float (default 0.5)
  • speed :: float (default 0.0)

scrollY

.scrollY( scrollY, speed )

  • scrollY :: float (default 0.5)
  • speed :: float (default 0.0)

Global variables

Useful variables that are defined globally, and can be used within functions as a parameter.

mouse

mouse

  • .x :: x position of mouse
  • .y :: y position of mouse

Example

Control the oscillator frequency with the mouse position:

osc(() => mouse.x).out(o0)

time

time

  • time :: the current time

Example

Control the oscillator using a sine wave based on the current time:

osc( ({time}) => Math.sin(time) )
.out(o0)

Modulators

Functions for describing modulations of sources.

modulate

.modulate( texture, amount )

Modulate texture. More about modulation at: https://lumen-app.com/guide/modulation/

modulateHue

.modulateHue( color, amount )

  • texture
    • color :: vec4
    • src
    • shape
  • amount :: float (default 1.0)

Changes coordinates based on hue of second input. Based on: https://www.shadertoy.com/view/XtcSWM

modulateKaleid

.modulateKaleid( nSides )

  • texture
    • color :: vec4
    • src
    • shape
  • nSides :: float (default 4.0)

modulatePixelate

.modulatePixelate( multiple, offset )

  • texture
    • color :: vec4
    • src
    • shape
  • multiple :: float (default 10.0)
  • offset :: float (default 3.0)

modulateRotate

.modulateRotate( multiple, offset )

  • texture
    • color :: vec4
    • src
    • shape
  • multiple :: float (default 1.0)
  • offset :: float (default 0.0)

modulateScale

.modulateScale( multiple, offset )

  • texture
    • color :: vec4
    • src
    • shape
  • multiple :: float (default 1.0)
  • offset :: float (default 1.0)

modulateScrollX

.modulateScrollX( multiple, scrollX, speed )

  • texture
    • color :: vec4
    • src
    • shape
  • scrollX :: float (default 0.5)
  • speed :: float (default 0.0)

modulateScrollY

.modulateScrollY( multiple, scrollY, speed )

  • texture
    • color :: vec4
    • src
    • shape
  • scrollY :: float (default 0.5)
  • speed :: float (default 0.0)