API Reference (Generated)
This file is generated by npm run docs:generate from source-of-truth APIs in:
src/index.d.tssrc/glsl/glsl-functions.js- module export files in
src/three/*.js,src/gui.js, andsrc/el.js
Do not edit this file manually.
Surface Summary
- Constructor options: 24
TriodeRenderermembers: 18TriodeSynthApimembers: 62TriodeSceneApimembers: 32- Transform chain members: 12
- Module namespaces: 10
- GLSL transforms: 69
Constructor Options (new Triode(options))
| Option | Type | Optional | Notes | ||
|---|---|---|---|---|---|
pb | unknown | yes | Legacy integration surface. | ||
width | number | yes | Initial canvas width. | ||
height | number | yes | Initial canvas height. | ||
numSources | number | yes | Number of source slots (s0..sN). | ||
numOutputs | number | yes | Number of output slots (o0..oN). | ||
makeGlobal | boolean | yes | Installs helpers globally when true; keep false for host-safe embedding. | ||
autoLoop | boolean | yes | Starts the internal RAF loop automatically. | ||
detectAudio | boolean | yes | Enables audio analysis helpers. | ||
errorPolicy | TriodeRuntimeErrorPolicy | yes | |||
argPolicy | TriodeArgPolicy | yes | |||
arrayHelpers | TriodeArrayHelpersMode | yes | |||
cssRenderers | TriodeCssRenderersMode | yes | |||
enableStreamCapture | boolean | yes | Enables recorder/capture setup. | ||
webgl | `1 \ | 2` | yes | Renderer backend version selection. | |
canvas | HTMLCanvasElement | yes | Use an existing canvas element instead of auto-creating one. | ||
css2DElement | HTMLElement | yes | Optional mount target for CSS2D renderer. | ||
css3DElement | HTMLElement | yes | Optional mount target for CSS3D renderer. | ||
precision | `"lowp" \ | "mediump" \ | "highp"` | yes | Shader precision hint. |
onError | TriodeRuntimeErrorHandler | yes | Runtime error hook for update/afterUpdate/tick contexts. | ||
liveMode | TriodeLiveMode | yes | continuous keeps runtime state; restart recreates runtime behavior. | ||
clock | TriodeClock | yes | |||
adapters | Partial<TriodeRuntimeAdapters> | yes | |||
legacy | boolean | yes | Compatibility mode restoring older defaults and warning behavior. | ||
extendTransforms | `Record<string, unknown> \ | Array<Record<string, unknown>>` | yes | Registers additional transform definitions at startup. |
TriodeRenderer Members
constructor(options?: TriodeOptions)eval(code: string, options?: TriodeEvalOptions): void- Evaluates livecoding source against the runtime sandbox.getScreenImage(callback: (blob: Blob) => void): voidhush(options?: { hooks?: boolean; outputs?: boolean; sources?: boolean }): voidresetRuntime(options?: TriodeResetOptions): void- Clears scene and runtime state without destroying the instance.reset(options?: TriodeResetOptions): voidfreeze(time?: number): voidresume(): voidstep(dtMs?: number): voidloadScript(url?: string, once?: boolean): Promise<void>setResolution(width: number, height: number): void- Resizes canvas, outputs, and source buffers.tick(dt: number, uniforms?: unknown): voidshadowMap(options?: Record<string, unknown>): voidscene(attributes?: TriodeSceneAttributes): TriodeSceneApistage(config?: TriodeStageConfig): TriodeSceneApi- Creates/reuses scene and applies stage presets.onFrame(callback: (dt: number, time: number) => void): voidliveGlobals(enable?: boolean): boolean- Toggles global helper installation at runtime.dispose(): void- Fully disposes the runtime and related resources.
TriodeSynthApi Members
time: numberbpm: numbercanvas: HTMLCanvasElementwidth: numberheight: numberfps?: numberstats: TriodeStatsspeed: numbermouse: unknownupdate: (dt: number) => voidonFrame: (callback: (dt: number, time: number) => void) => void- Installs an update callback receiving(dt, time).afterUpdate: (dt: number) => voidclick: (event: Event) => voidmousedown: (event: Event) => voidmouseup: (event: Event) => voidmousemove: (event: Event) => voidkeydown: (event: KeyboardEvent) => voidkeyup: (event: KeyboardEvent) => voidonError?: TriodeRuntimeErrorHandlerliveMode: TriodeLiveModelegacy: booleanrender: (output?: unknown) => voidliveGlobals: (enable?: boolean) => boolean- Toggles helper globals in the active runtime.setResolution: (width: number, height: number) => voidhush: (options?: { hooks?: boolean; outputs?: boolean; sources?: boolean }) => void- Clears outputs and reset frame hooks to no-op handlers.resetRuntime: (options?: TriodeResetOptions) => voidreset: (options?: TriodeResetOptions) => voidfreeze: (time?: number) => voidresume: () => voidstep: (dtMs?: number) => voidtick: (dt: number, uniforms?: unknown) => voidshadowMap: (options?: Record<string, unknown>) => voidscene: (attributes?: TriodeSceneAttributes) => TriodeSceneApi- Returns a scene handle for manual scene composition.stage: (config?: TriodeStageConfig) => TriodeSceneApi- Convenience scene bootstrap with camera/lights/world/render options.errorPolicy: TriodeRuntimeErrorPolicyargPolicy: TriodeArgPolicyortho: (eye?: TriodeNumericTuple, target?: TriodeNumericTuple, options?: TriodeCameraOptions) => unknownperspective: (eye?: TriodeNumericTuple, target?: TriodeNumericTuple, options?: TriodeCameraOptions) => unknownscreenCoords: (width?: number, height?: number) => unknownnormalizedCoords: () => unknowncartesianCoords: (width?: number, height?: number) => unknownsetFunction: (definition: TriodeTransformDefinition) => void- Registers a custom transform definition.osc: TriodeTransformFactorynoise: TriodeTransformFactorysolid: TriodeTransformFactorysrc: TriodeTransformFactorytx: TriodeTextureApigm: TriodeGeometryApimt: TriodeModuleApicmp: TriodeModuleApirnd: TriodeModuleApinse: TriodeModuleApitex: TriodeTextureApigeom: TriodeGeometryApimat: TriodeModuleApicompose: TriodeModuleApirandom: TriodeModuleApinoiseUtil: TriodeModuleApigui: TriodeGuiApiarr: TriodeModuleApiel: TriodeModuleApimath: Record<string, (value: number, ...args: number[]) => number>
TriodeSceneApi Members
add(geometry?: unknown, material?: unknown, options?: TriodeObjectOptions): TriodeSceneApimesh(geometry?: unknown, material?: unknown, options?: TriodeObjectOptions): TriodeSceneApibox(material?: unknown, options?: TriodeObjectOptions): TriodeSceneApisphere(material?: unknown, options?: TriodeObjectOptions): TriodeSceneApiquad(material?: unknown, options?: TriodeObjectOptions): TriodeSceneApipoints(geometry?: unknown, material?: unknown, options?: TriodeObjectOptions): TriodeSceneApilines(geometry?: unknown, material?: unknown, options?: TriodeObjectOptions): TriodeSceneApilineStrip(geometry?: unknown, material?: unknown, options?: TriodeObjectOptions): TriodeSceneApilineLoop(geometry?: unknown, material?: unknown, options?: TriodeObjectOptions): TriodeSceneApilinestrip(geometry?: unknown, material?: unknown, options?: TriodeObjectOptions): TriodeSceneApi- @deprecated Use lineStrip(...) instead.lineloop(geometry?: unknown, material?: unknown, options?: TriodeObjectOptions): TriodeSceneApi- @deprecated Use lineLoop(...) instead.line(geometry?: unknown, material?: unknown, options?: TriodeObjectOptions): TriodeSceneApicircle(geometry?: unknown, material?: unknown, options?: TriodeObjectOptions): TriodeSceneApiellipse(geometry?: unknown, material?: unknown, options?: TriodeObjectOptions): TriodeSceneApitriangle(geometry?: unknown, material?: unknown, options?: TriodeObjectOptions): TriodeSceneApilights(options?: Record<string, unknown>): TriodeSceneApiworld(options?: Record<string, unknown>): TriodeSceneApigroup(attributes?: TriodeSceneAttributes): TriodeSceneApi- Creates or reuses a scene subgroup.layer(id: number, options?: Record<string, unknown>): unknownlayerAdd(id: number, options?: Record<string, unknown>): TriodeSceneApilookAt(target: unknown, options?: Record<string, unknown>): TriodeSceneApiout(output?: unknown | TriodeRenderCallOptions, options?: TriodeTransformRenderOptions): TriodeSceneApirender(output?: unknown | TriodeRenderCallOptions, options?: TriodeTransformRenderOptions): TriodeSceneApi- Compiles the scene into output passes.autoClear(amount?: number, color?: number, options?: Record<string, unknown>): TriodeSceneApiclear(amount?: number, color?: number, options?: Record<string, unknown>): TriodeSceneApiat(index?: number, options?: { touch?: boolean }): unknownobj(index?: number, options?: { touch?: boolean }): unknowntexture(output?: unknown | TriodeRenderCallOptions, options?: Record<string, unknown>): unknown- Alias of.tex(...).instanced(geometry: unknown, material: unknown, count: number, options?: TriodeObjectOptions): unknown- Creates an instanced mesh object.instancedAdd(geometry: unknown, material: unknown, count: number, options?: TriodeObjectOptions): TriodeSceneApifind(filter?: Record<string, unknown>, options?: { touch?: boolean }): unknown[]- Returns matching child objects by property filter.empty(): boolean
Transform Chain Members
out( output?: unknown | TriodeRenderCallOptions, options?: TriodeTransformRenderOptions, ): TriodeTransformChainrender( output?: unknown | TriodeRenderCallOptions, options?: TriodeTransformRenderOptions, ): TriodeTransformChain- Alias of.out(...).autoClear(amount?: number, color?: number, options?: Record<string, unknown>): TriodeTransformChainclear(amount?: number, color?: number, options?: Record<string, unknown>): TriodeTransformChain- Alias of.autoClear(...).basic(options?: Record<string, unknown>): TriodeTransformChainphong(options?: Record<string, unknown>): TriodeTransformChainlambert(options?: Record<string, unknown>): TriodeTransformChainmaterial( typeOrOptions?: "basic" | "lambert" | "phong" | Record<string, unknown>, options?: Record<string, unknown>, ): TriodeTransformChain- Material bridge for basic/lambert/phong/custom options.st(source: TriodeTransformChain): TriodeTransformChaintex(output?: unknown | TriodeRenderCallOptions, options?: Record<string, unknown>): unknown- Renders the current chain to a texture.texture(output?: unknown | TriodeRenderCallOptions, options?: Record<string, unknown>): unknowntexMat(output?: unknown, options?: Record<string, unknown>): unknown- Returns a Three material with current chain texture attached.
Module Namespaces
| Namespace | Export Count | Notes |
|---|---|---|
arr | 17 | Typed-array utilities |
cmp | 7 | Alias: compose |
el | 2 | DOM element helpers |
gm | 32 | Alias: geom |
gui | 6 | GUI helpers |
math | 6 | Math helper namespace |
mt | 20 | Alias: mat |
nse | 14 | Alias: noiseUtil |
rnd | 15 | Alias: random |
tx | 15 | Alias: tex |
arr
create(len, mapfn)uint8(len, mapfn)float32(len, mapfn)noise(width, height = 1, options = {})random(width, height = 1, options = {})mirror(data)mirror1(data)image(url, callback)grid(width, height = 1, options = {})sum(list)mul(list, mul)concat(list1, list2)padTo(arr, len, value = 0)map(arr, from = [0, 0], to = [0, 1])normalize(arr)avg(arr)transpose(arr)
Typed-array utilities
cmp
size(object, precise = true)line(object, x = 0, gap = 0)stack(object, y = 0, gap = 0)circle(object, radius = 100)random(object, box)noise(object, box, opts = {})lookAt(scene, object, offset)
Alias: compose
el
create(tag, attributes)setAttributes(el, attributes)
DOM element helpers
gm
box(width = 1, height = 1, depth = 1, widthSegments = 1, heightSegments = 1, depthSegments = 1)capsule(radius = 1, length = 1, capSegments = 4, radialSegments = 8)circle(extent = 1, segments = 32, thetaStart = 0, thetaLength = Math.PI * 2)cone(radius = 1, height = 1, radialSegments = 32, heightSegments = 1, openEnded = false, thetaStart = 0, thetaLength = Math.PI * 2)cylinder(radiusTop = 1, radiusBottom = 1, height = 1, radialSegments = 32, heightSegments = 1, openEnded = false, thetaStart = 0, thetaLength = Math.PI * 2)dodecahedron(...args)edges(...args)extrude(...args)icosahedron(...args)lathe(...args)octahedron(...args)plane(...args)polyhedron(vertices = [], indices = [], radius = 1, detail = 0)ring(...args)sphere(...args)tetrahedron(...args)torus(...args)torusKnot(...args)tube(path, ...args)wireframe(...args)points(num)shape(shapes, curveSegments = 12)drawShape(points)line(points)rect(...args)ellipse(width = 1, height = 1, curveSegments = 24, thetaStart = 0, thetaEnd = 2 * Math.PI)triangle(...args)grid(...args)text(text, options = {})GridGeometry(...)posFromEleAzi(elevation, azimuth, radius = 1)signedArea(A, B, C)
Alias: geom
gui
init()create(name = "triode")addFolder(name, settings, setupFn, gui)lights(scene, camera, defaults = {})world(scene, defaults = {})hideSaveRow(nameOrGui)
GUI helpers
math
lerp(a, b, perc)map(n, start1, stop1, start2 = 0, stop2 = 1, withinBounds = false)constrain(n, low = 0, high = 1.0)nextPow2(n)rad(deg)deg(rad)
Math helper namespace
mt
basicProps(...)phongProps(...)lambertProps(...)meshBasic(options)meshPhong(options)meshLambert(options)meshStandard(options)lineBasic(options)points(options)worldPosGradientY(options, uniOptions)hydra(source, properties = {})triode(...args)dots(pos, size, color, fade, options = {})squares(pos, size, color, fade, options = {})lines(pos, color, options = {})linestrip(pos, color, options = {})lineloop(pos, color, options = {})text(color, options = {})mesh(color, options = {})getBlend(blendMode)
Alias: mat
nse
types(...)options(...)pink(...)brown(...)yellow(...)improved(...)init(opts = {})fbm(noiseFn, H, opts = {})get2(x, y, min = 0, max = 1, scale = 1, type = IMPROVED)get3(x, y, z, min = 0, max = 1, scale = 1, type = IMPROVED)get4(x, y, z, w, min = 0, max = 1, scale = 1, type = IMPROVED)PINK(...)BROWN(...)YELLOW(...)
Alias: noiseUtil
rnd
setfn(func)num(a = 0.0, b = 1.0)int(a, b)bool(p = 0.5)choice(list)exp(a, b, n = 2)gauss(mean, sd = 1, y1 = false, prevKey = 'gauss')gaussMinMax(a = 0, b = 1, y1 = false, prevKey = 'gaussMinMax')cache(name, gen)cacheNum(name, a = 0.0, b = 1.0)cacheGauss(name, mean, sd = 1, prevKey = 'cacheGauss')cacheGaussMinMax(name, a = 0, b = 1, prevKey = 'cacheGaussMinMax')cacheBool(name, p = 0.5)arr(len)color()
Alias: random
tx
get(id)set(id, tex)data(data_, options_ = {})dataArray(data_, options_ = {})load(url, onLoad, onError)save(tex, options = {})wrap(tex, options = {})repeat(tex, x = 2, y = 2)mirror(tex, x = 2, y = 2, options = {})mirror1(texture, x = 2, y = 2, options = {})pointsym(texture, options = {})atlas(textures, options = {})createSceneTexture(scene, options = {})createQuadScene(material, options = {})fbo(options = {})
Alias: tex
Transform Catalog
color
abbrightnesscolorcoloramacontrastghueinvertlumaposterizersaturateshiftsumthresh
combine
addblenddifflayermaskmultsub
combineCoord
modulatemodulateHuemodulateKaleidmodulatePixelatemodulateRepeatmodulateRepeatXmodulateRepeatYmodulateRotatemodulateScalemodulateScrollXmodulateScrollY
coord
kaleidpixelaterepeatrepeatXrepeatYrotaterotateDegrotateRadscalescrollscrollXscrollY
genType
atancosmappowsintan
glsl
glsl
src
cnoisefbmgradienthexnoiseoscpnoiseprevshapesnoisesolidsolid2solid3srcvoronoiwnoise