diff --git a/docs/funcs.md b/docs/funcs.md index c30e5830..ba459f8e 100644 --- a/docs/funcs.md +++ b/docs/funcs.md @@ -1,3 +1,5 @@ + # Functions - [Categories of functions](#categories) @@ -25,9 +27,10 @@ - [show](#show) - [Color](#color) - [brightness](#brightness) - - [contrast](#contrast) - - [color `vec4`](#color-vec4) + - [color](#color) - [colorama](#colorama) + - [contrast](#contrast) + - [hue](#hue) - [invert](#invert) - [luma](#luma) - [posterize](#posterize) @@ -38,27 +41,27 @@ - [kaleid](#kaleid) - [pixelate](#pixelate) - [repeat](#repeat) - - [repeatX](#repeatX) - - [repeatY](#repeatY) + - [repeatX](#repeatx) + - [repeatY](#repeaty) - [rotate](#rotate) - [scale](#scale) - - [scrollX](#scrollX) - - [scrollY](#scrollY) + - [scrollX](#scrollx) + - [scrollY](#scrolly) - [Global variables](#global-variables) - [mouse](#mouse) - [time](#time) - [Modulators](#modulators) - [modulate](#modulate) - - [modulateHue](#modulateHue) - - [modulateKaleid](#modulateKaleid) - - [modulatePixelate](#modulatePixelate) - - [modulateRepeat](#modulateRepeat) - - [modulateRepeatX](#modulateRepeatX) - - [modulateRepeatY](#modulateRepeatY) - - [modulateRotate](#modulateRotate) - - [modulateScale](#modulateScale) - - [modulateScrollX](#modulateScrollX) - - [modulateScrollY](#modulateScrollY) + - [modulateHue](#modulatehue) + - [modulateKaleid](#modulatekaleid) + - [modulatePixelate](#modulatepixelate) + - [modulateRepeat](#modulaterepeat) + - [modulateRepeatX](#modulaterepeatx) + - [modulateRepeatY](#modulaterepeaty) + - [modulateRotate](#modulaterotate) + - [modulateScale](#modulatescale) + - [modulateScrollX](#modulatescrollx) + - [modulateScrollY](#modulatescrolly) - [Operators](#operators) - [add](#add) - [blend](#blend) @@ -70,12 +73,12 @@ - [gradient](#gradient) - [noise](#noise) - [osc](#osc) - - [out](#out) - - [render](#render) - [shape](#shape) - [solid](#solid) - [src](#src) - [voronoi](#voronoi) + - [out](#out) + - [render](#render) - [Parameter sequences](#parameter-sequences) - [Lists as parameter sequences](#lists-as-parameter-sequences) - [Functions on parameter sequences](#functions-on-parameter-sequences) @@ -132,16 +135,18 @@ Functions for manipulating audio signals. Functions for manipulating color. -- [brightness](#brightness) -- [contrast](#contrast) -- [color `vec4`](#color-vec4) -- [colorama](#colorama) -- [invert](#invert) -- [luma](#luma) -- [posterize](#posterize) -- [saturate](#saturate) -- [shift](#shift) -- [thresh](#thresh) + - [brightness](#brightness) + - [color](#color) + - [colorama](#colorama) + - [contrast](#contrast) + - [hue](#hue) + - [invert](#invert) + - [luma](#luma) + - [posterize](#posterize) + - [saturate](#saturate) + - [shift](#shift) + - [thresh](#thresh) + ### brightness @@ -157,39 +162,15 @@ osc(20,0,2) .out(o0) ``` -### contrast - -`.contrast( amount )` - -* `amount` :: float (default `1.6`) - -Larger `amount` value makes higher contrast. - -#### Example - -```javascript -// 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 )` +### color -* `r` :: float -* `g` :: float -* `b` :: float +`.color( r, g, b, a )` -Colorize texture. +* `r` :: float (default `1`) +* `g` :: float (default `1`) +* `b` :: float (default `1`) +* `a` :: float (default `1`) -#### Example - -```javascript -// 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 @@ -212,16 +193,33 @@ osc(20) .out(o0) ``` +### contrast + +`.contrast( amount )` + +* `amount` :: float (default `1.6`) + +Larger amount value makes higher contrast. + +#### Example + ```javascript -// -noise(3,0.1).colorama( ({time}) => Math.sin(time/5) ).out(o0) +// 20Hz oscillator with contrast interpolating between 0.0-5.0 +osc(20).contrast( ({time}) => Math.sin(time) * 5 ).out(o0) ``` +### hue + +`.hue( hue )` + +* `hue` :: float (default `0.4`) + + ### invert `.invert( amount )` -* `amount` :: float (default `1.0`) +* `amount` :: float (default `1`) Invert color. @@ -251,7 +249,7 @@ 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 (default `3.0`) +* `bins` :: float (default `3`) * `gamma` :: float (default `0.6`) #### Example @@ -268,7 +266,7 @@ gradient(0).posterize( 3, [0.1, 0.5, 1.0, 2.0] ).out(o0) `.saturate( amount )` -* `amount` :: float (default `2.0`) +* `amount` :: float (default `2`) #### Example @@ -281,15 +279,10 @@ osc(10,0,1).saturate( ({time}) => Math.sin(time) * 10 ).out() `.shift( r, g, b, a )` * `r` :: float (default `0.5`) -* `g` :: float (default `0.5`) -* `b` :: float (default `0.5`) -* `a` :: float (default `0.5`) +* `g` :: float (default `0`) +* `b` :: float (default `0`) +* `a` :: float (default `0`) -#### Example - -```javascript - -``` ### thresh @@ -315,21 +308,22 @@ noise(3,0.1) Functions for manipulating geometry. -- [kaleid](#kaleid) -- [pixelate](#pixelate) -- [repeat](#repeat) -- [repeatX](#repeatX) -- [repeatY](#repeatY) -- [rotate](#rotate) -- [scale](#scale) -- [scrollX](#scrollX) -- [scrollY](#scrollY) + - [kaleid](#kaleid) + - [pixelate](#pixelate) + - [repeat](#repeat) + - [repeatX](#repeatx) + - [repeatY](#repeaty) + - [rotate](#rotate) + - [scale](#scale) + - [scrollX](#scrollx) + - [scrollY](#scrolly) + ### kaleid `.kaleid( nSides )` -* `nSides` :: float (default `4.0`) +* `nSides` :: float (default `4`) Kaleidoscope effect with `nSides` repetition. @@ -341,10 +335,10 @@ osc(25,-0.1,0.5).kaleid(50).out(o0) ### pixelate -`.pixelate( x, y )` +`.pixelate( pixelX, pixelY )` -* `pixelX` :: float (default `20.0`) -* `pixelY` :: float (default `20.0`) +* `pixelX` :: float (default `20`) +* `pixelY` :: float (default `20`) Pixelate texture with `pixelX` segments and `pixelY` segments. @@ -367,10 +361,10 @@ noise() `.repeat( repeatX, repeatY, offsetX, offsetY )` -* `repeatX` :: float (default `3.0`) -* `repeatY` :: float (default `3.0`) -* `offsetX` :: float (default `0.0`) -* `offsetY` :: float (default `0.0`) +* `repeatX` :: float (default `3`) +* `repeatY` :: float (default `3`) +* `offsetX` :: float (default `0`) +* `offsetY` :: float (default `0`) #### Example @@ -390,8 +384,8 @@ shape(1.25,0.5,0.25) `.repeatX( reps, offset )` -* `reps` :: float (default `3.0`) -* `offset` :: float (default `0.0`) +* `reps` :: float (default `3`) +* `offset` :: float (default `0`) #### Example @@ -409,8 +403,8 @@ osc(5,0,1) `.repeatY( reps, offset )` -* `reps` :: float (default `3.0`) -* `offset` :: float (default `0.0`) +* `reps` :: float (default `3`) +* `offset` :: float (default `0`) #### Example @@ -427,8 +421,8 @@ osc(5,0,1) `.rotate( angle, speed )` -* `angle` :: float (default `10.0`) -* `speed` :: float (default `0.0`) +* `angle` :: float (default `10`) +* `speed` :: float (default `0`) Rotate texture. @@ -438,17 +432,19 @@ 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) + .rotate( ({time}) => time%360, ({time}) => Math.sin(time*0.1)*0.05 ) + .out(o0) ``` ### scale -`.scale( size, xMult, yMult )` +`.scale( amount, xMult, yMult, offsetX, offsetY )` -* `size` :: float (default `1.5`) -* `xMult` :: float (default `1.0`) -* `yMult` :: float (default `1.0`) +* `amount` :: float (default `1.5`) +* `xMult` :: float (default `1`) +* `yMult` :: float (default `1`) +* `offsetX` :: float (default `0.5`) +* `offsetY` :: float (default `0.5`) Scale texture. @@ -472,7 +468,7 @@ shape().scale(1.5,[0.25,0.5,0.75,1].fast(0.25),[3,2,1]) `.scrollX( scrollX, speed )` * `scrollX` :: float (default `0.5`) -* `speed` :: float (default `0.0`) +* `speed` :: float (default `0`) #### Example @@ -500,7 +496,7 @@ gradient(0.125) `.scrollY( scrollY, speed )` * `scrollY` :: float (default `0.5`) -* `speed` :: float (default `0.0`) +* `speed` :: float (default `0`) #### Example @@ -567,30 +563,32 @@ osc( ({time}) => Math.sin(time) ).out(o0) Functions for describing modulations of sources. -- [modulate](#modulate) -- [modulateHue](#modulateHue) -- [modulateKaleid](#modulateKaleid) -- [modulatePixelate](#modulatePixelate) -- [modulateRepeat](#modulateRepeat) -- [modulateRepeatX](#modulateRepeatX) -- [modulateRepeatY](#modulateRepeatY) -- [modulateRotate](#modulateRotate) -- [modulateScale](#modulateScale) -- [modulateScrollX](#modulateScrollX) -- [modulateScrollY](#modulateScrollY) + - [modulate](#modulate) + - [modulateHue](#modulatehue) + - [modulateKaleid](#modulatekaleid) + - [modulatePixelate](#modulatepixelate) + - [modulateRepeat](#modulaterepeat) + - [modulateRepeatX](#modulaterepeatx) + - [modulateRepeatY](#modulaterepeaty) + - [modulateRotate](#modulaterotate) + - [modulateScale](#modulatescale) + - [modulateScrollX](#modulatescrollx) + - [modulateScrollY](#modulatescrolly) + ### modulate `.modulate( texture, amount )` -* `texture` - * `color` :: see [color `vec4`](#color-vec4) - * `src` :: see [`src`](#src) - * `shape` :: see [`shape`](#shape) +* `texture` :: vec4 * `amount` :: float (default `0.1`) -Modulate texture. -More about modulation at: https://lumen-app.com/guide/modulation/ +Modulate texture. + +More about modulation at: + +The `texture` parameter can be any kind of [source](#sources), for +example a [`color`](#color), [`src`](#src), or [`shape`](#shape). #### Example @@ -600,41 +598,35 @@ 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) + .kaleid(50) + .scale(({time})=>Math.sin(time*1)*0.5+1) + .modulate(noise(0.6,0.5)), + 0.5) .out(o0) ``` ### modulateHue -`.modulateHue( color, amount )` +`.modulateHue( texture, amount )` -* `texture` - * `color` :: see [color `vec4`](#color-vec4) - * `src` :: see [`src`](#src) - * `shape` :: see [`shape`](#shape) -* `amount` :: float (default `1.0`) +* `texture` :: vec4 +* `amount` :: float (default `1`) -Changes coordinates based on hue of second input. -Based on:https://www.shadertoy.com/view/XtcSWM +Changes coordinates based on hue of second input. Based on: https://www.shadertoy.com/view/XtcSWM -#### Example +The `texture` parameter can be any kind of [source](#sources), for +example a [`color`](#color), [`src`](#src), or [`shape`](#shape). -```javascript - -``` ### modulateKaleid -`.modulateKaleid( nSides )` +`.modulateKaleid( texture, nSides )` -* `texture` - * `color` :: see [color `vec4`](#color-vec4) - * `src` :: see [`src`](#src) - * `shape` :: see [`shape`](#shape) -* `nSides` :: float (default `4.0`) +* `texture` :: vec4 +* `nSides` :: float (default `4`) + +The `texture` parameter can be any kind of [source](#sources), for +example a [`color`](#color), [`src`](#src), or [`shape`](#shape). See also: [`kaleid`](#kaleid). @@ -651,14 +643,14 @@ osc(9,-0.1,0.1) ### modulatePixelate -`.modulatePixelate( multiple, offset )` +`.modulatePixelate( texture, multiple, offset )` + +* `texture` :: vec4 +* `multiple` :: float (default `10`) +* `offset` :: float (default `3`) -* `texture` - * `color` :: see [color `vec4`](#color-vec4) - * `src` :: see [`src`](#src) - * `shape` :: see [`shape`](#shape) -* `multiple` :: float (default `10.0`) -* `offset` :: float (default `3.0`) +The `texture` parameter can be any kind of [source](#sources), for +example a [`color`](#color), [`src`](#src), or [`shape`](#shape). See also: [`pixelate`](#pixelate) @@ -675,15 +667,15 @@ voronoi(10,1,5).brightness(()=>Math.random()*0.15) `.modulateRepeat( texture, repeatX, repeatY, offsetX, offsetY )` -* `texture` - * `color` :: see [color `vec4`](#color-vec4) - * `src` :: see [`src`](#src) - * `shape` :: see [`shape`](#shape) -* `repeatX` :: float (default `3.0`) -* `repeatY` :: float (default `3.0`) +* `texture` :: vec4 +* `repeatX` :: float (default `3`) +* `repeatY` :: float (default `3`) * `offsetX` :: float (default `0.5`) * `offsetY` :: float (default `0.5`) +The `texture` parameter can be any kind of [source](#sources), for +example a [`color`](#color), [`src`](#src), or [`shape`](#shape). + #### Example ```javascript @@ -698,13 +690,13 @@ shape(4,0.9) `.modulateRepeatX( texture, reps, offset )` -* `texture` - * `color` :: see [color `vec4`](#color-vec4) - * `src` :: see [`src`](#src) - * `shape` :: see [`shape`](#shape) -* `reps` :: float (default `3.0`) +* `texture` :: vec4 +* `reps` :: float (default `3`) * `offset` :: float (default `0.5`) +The `texture` parameter can be any kind of [source](#sources), for +example a [`color`](#color), [`src`](#src), or [`shape`](#shape). + #### Example ```javascript @@ -720,13 +712,13 @@ shape(4,0.9) `.modulateRepeatY( texture, reps, offset )` -* `texture` - * `color` :: see [color `vec4`](#color-vec4) - * `src` :: see [`src`](#src) - * `shape` :: see [`shape`](#shape) -* `reps` :: float (default `3.0`) +* `texture` :: vec4 +* `reps` :: float (default `3`) * `offset` :: float (default `0.5`) +The `texture` parameter can be any kind of [source](#sources), for +example a [`color`](#color), [`src`](#src), or [`shape`](#shape). + #### Example ```javascript @@ -742,12 +734,12 @@ shape(4,0.9) `.modulateRotate( texture, multiple, offset )` -* `texture` - * `color` :: see [color `vec4`](#color-vec4) - * `src` :: see [`src`](#src) - * `shape` :: see [`shape`](#shape) -* `multiple` :: float (default `1.0`) -* `offset` :: float (default `0.0`) +* `texture` :: vec4 +* `multiple` :: float (default `1`) +* `offset` :: float (default `0`) + +The `texture` parameter can be any kind of [source](#sources), for +example a [`color`](#color), [`src`](#src), or [`shape`](#shape). See also: [`rotate`](#rotate) @@ -763,16 +755,16 @@ voronoi(100,3,5) ### modulateScale -`.modulateScale( multiple, offset )` +`.modulateScale( texture, multiple, offset )` -* `texture` - * `color` :: see [color `vec4`](#color-vec4) - * `src` :: see [`src`](#src) - * `shape` :: see [`shape`](#shape) -* `multiple` :: float (default `1.0`) -* `offset` :: float (default `1.0`) +* `texture` :: vec4 +* `multiple` :: float (default `1`) +* `offset` :: float (default `1`) -See also: [`scale`](#scale) +The `texture` parameter can be any kind of [source](#sources), for +example a [`color`](#color), [`src`](#src), or [`shape`](#shape). + +See also: [`scale`](#scale). #### Example @@ -785,16 +777,16 @@ gradient(5).repeat(50,50).kaleid([3,5,7,9].fast(0.5)) ### modulateScrollX -`.modulateScrollX( multiple, scrollX, speed )` +`.modulateScrollX( texture, scrollX, speed )` -* `texture` - * `color` :: see [color `vec4`](#color-vec4) - * `src` :: see [`src`](#src) - * `shape` :: see [`shape`](#shape) +* `texture` :: vec4 * `scrollX` :: float (default `0.5`) -* `speed` :: float (default `0.0`) +* `speed` :: float (default `0`) + +The `texture` parameter can be any kind of [source](#sources), for +example a [`color`](#color), [`src`](#src), or [`shape`](#shape). -See also: [`scrollX`](#scrollx) +See also: [`scrollX`](#scrollX) #### Example @@ -812,14 +804,14 @@ voronoi(25,0,0) ### modulateScrollY -`.modulateScrollY( multiple, scrollX, speed )` +`.modulateScrollY( texture, scrollY, speed )` -* `texture` - * `color` :: see [color `vec4`](#color-vec4) - * `src` :: see [`src`](#src) - * `shape` :: see [`shape`](#shape) +* `texture` :: vec4 * `scrollY` :: float (default `0.5`) -* `speed` :: float (default `0.0`) +* `speed` :: float (default `0`) + +The `texture` parameter can be any kind of [source](#sources), for +example a [`color`](#color), [`src`](#src), or [`shape`](#shape). See also: [`scrollY`](#scrollY) @@ -837,31 +829,30 @@ voronoi(25,0,0) .out(o0) ``` ---- - ## Operators Functions for performing operations on sources. -- [add](#add) -- [blend](#blend) -- [diff](#diff) -- [layer](#layer) -- [mask](#mask) -- [mult](#mult) + - [add](#add) + - [blend](#blend) + - [diff](#diff) + - [layer](#layer) + - [mask](#mask) + - [mult](#mult) + ### add `.add( texture, amount )` -* `texture` - * `color` :: see [color `vec4`](#color-vec4) - * `src` :: see [`src`](#src) - * `shape` :: see [`shape`](#shape) +* `texture` :: vec4 * `amount` :: float (default `0.5`) Add textures. +The `texture` parameter can be any kind of [source](#sources), for +example a [`color`](#color), [`src`](#src), or [`shape`](#shape). + #### Example ```javascript @@ -874,14 +865,14 @@ osc(9,0.1,1).add(osc(13,0.5,5)).out() `.blend( texture, amount )` -* `texture` - * `color` :: see [color `vec4`](#color-vec4) - * `src` :: see [`src`](#src) - * `shape` :: see [`shape`](#shape) +* `texture` :: vec4 * `amount` :: float (default `0.5`) Blend textures. +The `texture` parameter can be any kind of [source](#sources), for +example a [`color`](#color), [`src`](#src), or [`shape`](#shape). + #### Example ```javascript @@ -894,13 +885,13 @@ osc(9,0.1,1).blend(osc(13,0.5,5)).out() `.diff( texture )` -* `texture` - * `color` :: see [color `vec4`](#color-vec4) - * `src` :: see [`src`](#src) - * `shape` :: see [`shape`](#shape) +* `texture` :: vec4 Return difference of textures. +The `texture` parameter can be any kind of [source](#sources), for +example a [`color`](#color), [`src`](#src), or [`shape`](#shape). + #### Example ```javascript @@ -918,13 +909,13 @@ osc(1,1,2) `.layer( texture )` -* `texture` - * `color` :: see [color `vec4`](#color-vec4) - * `src` :: see [`src`](#src) - * `shape` :: see [`shape`](#shape) +* `texture` :: vec4 Overlay texture based on alpha value. + The `texture` parameter can be any kind of [source](#sources), for + example a [`color`](#color), [`src`](#src), or [`shape`](#shape). + #### Example ```javascript @@ -935,11 +926,8 @@ 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 [color `vec4`](#color-vec4) - * `src` :: see [`src`](#src) - * `shape` :: see [`shape`](#shape) -* `reps` :: float (default `3.0`) +* `texture` :: vec4 +* `reps` :: float (default `3`) * `offset` :: float (default `0.5`) #### Example @@ -961,14 +949,14 @@ osc(10,-0.25,1).color(0,0,1).saturate(2).kaleid(50) `.mult( texture, amount )` -* `texture` - * `color` :: see [color `vec4`](#color-vec4) - * `src` :: see [`src`](#src) - * `shape` :: see [`shape`](#shape) -* `amount` :: float (default `1.0`) +* `texture` :: vec4 +* `amount` :: float (default `1`) Multiply images and blend with the texture by `amount`. +The `texture` parameter can be any kind of [source](#sources), for +example a [`color`](#color), [`src`](#src), or [`shape`](#shape). + #### Example ```javascript @@ -981,21 +969,22 @@ osc(9,0.1,2).mult(osc(13,0.5,5)).out() Sources are elementary generators that output different types of visual content. -- [gradient](#gradient) -- [noise](#noise) -- [osc](#osc) -- [out](#out) -- [render](#render) -- [shape](#shape) -- [solid](#solid) -- [src](#src) -- [voronoi](#voronoi) + - [gradient](#gradient) + - [noise](#noise) + - [osc](#osc) + - [shape](#shape) + - [solid](#solid) + - [src](#src) + - [voronoi](#voronoi) + - [out](#out) + - [render](#render) + ### gradient `gradient( speed )` -* `speed` :: float (default `x`) +* `speed` :: float (default `0`) #### Example @@ -1008,7 +997,7 @@ gradient([1,2,4]).out(o0) `noise( scale, offset )` -* `scale` :: int (default `10.0`) +* `scale` :: float (default `10`) * `offset` :: float (default `0.1`) Generate [Perlin noise](https://en.wikipedia.org/wiki/Perlin_noise). @@ -1018,16 +1007,16 @@ Generate [Perlin noise](https://en.wikipedia.org/wiki/Perlin_noise). ```javascript // noise interpolating between different scales and offsets noise( ({time}) => Math.sin(time/10)*50 , ({time}) => Math.sin(time/2)/500 ) - .out(o0) +.out(o0) ``` ### osc `osc( frequency, sync, offset )` -* `frequency` :: float (default `60.0`) +* `frequency` :: float (default `60`) * `sync` :: float (default `0.1`) -* `offset` :: float (default `0.0`) +* `offset` :: float (default `0`) #### Example @@ -1045,63 +1034,11 @@ osc( 10, [-10,-1,-0.1,0,0.1,1,10], 0 ).out(o0) osc(10,0.1, ({time}) => Math.sin(time/10) * 100 ).out(o0) ``` -### out - -`.out( buffer )` - -* `buffer` - * `osc`: `o0`, `o1`, `o2`, `o3` - * `src`: `s0`, `s1`, `s2`, `s3` - -#### Example - -```javascript -// 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 - -`render( buffer )` - -* `buffer`: buffer (default `o0`) - -#### Example - -```javascript -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 -``` - -```javascript -// 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 -`shape( sides, radius, smoothing)` +`shape( sides, radius, smoothing )` -* `sides` :: int (default `3.0`) +* `sides` :: float (default `3`) * `radius` :: float (default `0.3`) * `smoothing` :: float (default `0.01`) @@ -1126,10 +1063,10 @@ shape(5,0.5,0.1).repeat(19,19) `solid( r, g, b, a )` -* `r` :: float (default `0.0`) -* `g` :: float (default `0.0`) -* `b` :: float (default `0.0`) -* `a` :: float (default `1.0`) +* `r` :: float (default `0`) +* `g` :: float (default `0`) +* `b` :: float (default `0`) +* `a` :: float (default `1`) #### Example @@ -1146,6 +1083,7 @@ solid([1,0,0],[0,1,0],[0,0,1],1).out(o0) See `hydra-examples` repository + ### voronoi `voronoi( scale, speed, blending )` @@ -1166,6 +1104,58 @@ voronoi(5,0.3,0.3).out(o0) voronoi(25,2,10).color(1,1,0).brightness(0.15).out(o0) ``` +### out + +`.out( buffer )` + +* `buffer` + * `osc`: `o0`, `o1`, `o2`, `o3` + * `src`: `s0`, `s1`, `s2`, `s3` + +#### Example + +```javascript +// 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 + +`render( buffer )` + +* `buffer`: buffer (default `o0`) + +#### Example + +```javascript +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 +``` + +```javascript +// 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() +``` + --- ## Parameter sequences