SceneParameterAccess

What an environment sees of its scene's parameters, as ctx.parameters: the table, where each stands, and how to move one.

@internote/canvas-sdkInterface
On this page
import { SceneParameterAccess } from '@internote/canvas-sdk';

all is the scene's table, every control's parameter wherever the control was written plus the loose letters each environment contributed through freeParameters, and it is stable between renders. The two readings are functions rather than snapshots because a swept parameter moves every frame, and a surface asking what t holds is asking about this frame.

A surface that draws with the parameters subscribes through useSceneParameters, since the state lives in the scene's session slot and a write to it does not re-render the environment on its own.

#Fields

allRequired
Every parameter the scene holds, in source order.
Parameter[]
declaredRequired
Every name the scene's controls declare, hidden and unfired too — not all's, which drops those and adds loose letters.
ReadonlySet<string>
idleRequired
Returns the names of all's parameters that nothing on the scene reads at this moment — the curve that uses one is cued out, say — so moving them would change nothing. Empty whenever an environment cannot say what it reads.
ReadonlySet<string>
numbersRequired
Returns the numeric parameters alone, by name, which is what an expression may be evaluated against.
Record<string, number>
setRequired
Moves a parameter: to a value for a plain control, or by a sweep displacement for a swept one.
void
stateRequired
Returns the reader's raw state, as one object whose identity changes only when something moves. The snapshot a useSyncExternalStore needs, since values() builds a fresh object every call.
ParameterState | undefined
subscribeRequired
Calls the listener after every move, and returns the unsubscribe.
() => void
valuesRequired
Returns what each parameter holds right now, by name, read against the scene clock.
Record<string, ParameterValue>

#Example

const { a, b } = ctx.parameters.numbers();
const y = evaluateExpression(curve.js, { a, b, x });

Declared in packages/canvas-sdk/src/parameters/index.ts:588.

Last updated