triode

Parameter Reference Tables

This page summarizes frequently used parameters and defaults for core public APIs. For behavior-level edge cases (units, precedence, and internal/public boundaries), see docs/reference/semantic-clarifications.md.

Triode constructor options

OptionTypeDefaultNotes
widthnumber1280Initial canvas width.
heightnumber720Initial canvas height.
canvasHTMLCanvasElementauto-createdProvide your own canvas for embedding.
makeGlobalbooleanfalseInstalls globals like osc, render and the utility modules. Use liveGlobals(true) to opt in at runtime (legacy: true defaults this to true).
autoLoopbooleantrueStarts internal RAF loop automatically.
detectAudiobooleanfollows makeGlobalInitializes audio analyzer (a bins). Defaults to false in non-global mode unless explicitly set.
errorPolicy{ maxPerSecond?, dedupeWindowMs?, verbose?, pauseOnError? }{4,1000,false,false}Runtime error dedupe/rate policy for update/afterUpdate/tick/compile contexts.
argPolicy{ invalid?, nanFallback? }{ invalid: "warn", nanFallback: 0 }Argument coercion policy container (current runtime stores and exposes this policy for host tooling).
arrayHelpers`"prototype" \"module"`"prototype"Controls whether Array prototype helpers are installed globally.
numSourcesnumber4Number of source slots s0..sN.
numOutputsnumber4Number of output slots o0..oN.
forceWebGLbooleanfalseForce the WebGL 2 backend. The default selects WebGPU and falls back to WebGL 2.
onError(error, context) => voidunsetRuntime hook for update/afterUpdate/tick failures.
liveMode`"restart" \"continuous"`"continuous"Eval behavior: reset on each eval vs reuse of the running outputs (legacy: true defaults this to "restart").
legacybooleanfalseCompatibility mode: restores legacy constructor defaults and suppresses deprecation warnings for rotate(...).
enableStreamCapturebooleantrueEnables vidRecorder capture setup.
extendTransformsobject/array{}Registers custom transforms at startup.
pbunknownnullLegacy/peer stream source integration input.

Playground scene options

BindingPurpose
renderScene(tree, oN, options)Publish a JSX producer to an output.
cameraPositionInitial camera position as [x, y, z].
orthographicSelect orthographic projection. Use "pixels" for pixel units or "viewport" for the window aspect ratio.
controlsEnable orbit controls.
clearAlphaSet the scene background alpha.
TriodeMaterialRead a Hydra chain through signal or read a live output with mipmaps through mipmappedSource.

Module namespace aliases

Long-form aliases are available alongside short module names:

Canonical shortFriendly aliasNotes
txtexTexture loaders/FBO/data helpers.
rndrandomRandom helpers.
nsenoiseUtilNoise utility module alias; noise() remains the shader generator function.

Runtime scope note:

  • Use runtime-bound module APIs (H.mat, H.geom, H.tex, etc. or global helpers when enabled) instead of unscoped internal module imports, so helper calls resolve to the intended Hydra runtime instance.

Output render options

OptionScopeNotes
renderTargetcompiled pass optionsRoute pass output into explicit target.
autoClearoutput/scene/chain1 = clear, <1 = accumulation fade.
fxoutput/scene/chainAdds post-processing passes.

Object-style render shorthand is also supported:

  • render({ to, target, css, fx, ... })
  • out({ to, target, css, fx, ... })

Mappings:

  • to -> render output
  • target -> renderTarget

Runtime hooks

HookPurpose
update(dt)user animation/update function each frame interval
onFrame((dt, time) => void)convenience helper to bind update with time
afterUpdate(dt)post-render callback
click, mousedown, mouseup, mousemoveinput event hooks routed from canvas
keydown, keyupkeyboard hooks routed from document
onError(error, { context, time })centralized runtime error handling
liveGlobals(enable?)toggles runtime global helper installation

Runtime control helpers

MethodPurpose
eval(code, options?)Evaluate live code with per-call mode/reset/hush controls.
reset(options?)Alias to resetRuntime with granular flags (scene/time/hooks/outputs/sources).
freeze(time?)Pause time progression at current or explicit time.
step(dtMs?)Advance a single deterministic frame step (works with frozen runtime).
resume()Resume realtime clock progression after freeze.

Source docs/reference/parameter-reference.md