Watcher
An on-stage readout that displays the live value of a variable or expression, like the score box in the corner of a game. It updates automatically as the value it watches changes.
The Watcher engine class. Most members are available as free functions; this page documents the underlying API for advanced use.
height
Section titled “height”Watcher.height: number | undefinedThe watcher’s height in stage units, or undefined to size automatically.
Since 1.0.0
Watcher.label: stringThe text label shown next to the watcher’s value on the stage.
Since 1.0.0
Watcher.max: numberThe largest value the slider style watcher allows.
Since 1.0.0
Watcher.min: numberThe smallest value the slider style watcher allows.
Since 1.0.0
setValue
Section titled “setValue”Watcher.setValue: (value: number) => voidFunction that updates the underlying variable when the slider is dragged.
Since 1.0.0
Watcher.step: numberHow much the slider value changes with each step.
Since 1.0.0
Watcher.style: WatcherStyleHow the watcher looks on the stage: “normal”, “large”, or “slider”.
Since 1.0.0
updateDOM
Section titled “updateDOM”Watcher.updateDOM(renderTarget: HTMLElement | null): voidRefreshes the watcher’s on-screen display to match the current value.
Since 1.0.0
Watcher.value: () => WatcherValueFunction that returns the current value to display on the stage.
Since 1.0.0
visible
Section titled “visible”Watcher.visible: booleanWhether the watcher is shown on the stage.
Since 1.0.0
Watcher.width: number | undefinedThe watcher’s width in stage units, or undefined to size automatically.
Since 1.0.0
Watcher.x: numberThe watcher’s horizontal position on the stage.
Since 1.0.0
Watcher.y: numberThe watcher’s vertical position on the stage.
Since 1.0.0