textmode.overlay.js / TextmodeOverlayController
Interface: TextmodeOverlayController
Controls the sampled target and DOM alignment for one textmode.js instance.
The controller never owns the output canvas. Clearing or uninstalling the plugin restores the canvas to its original DOM location and inline styles.
Controller state
The current sampled target, its configurable texture source, and output visibility state.
source
readonly source: TextmodeTexture | undefined;The configurable texture created from target.
target
readonly target:
| TextmodeOverlayTarget
| undefined;The currently sampled canvas or video.
Target binding
Attach a target to sample and release it to restore the output canvas.
clearTarget()
clearTarget(): void;Stop sampling and restore the output canvas.
Returns
void
Example
t.overlay.clearTarget();setTarget()
setTarget(target): TextmodeTexture;Sample a target and align the textmode output canvas above it.
Parameters
| Parameter | Type | Description |
|---|---|---|
target | TextmodeOverlayTarget | Canvas or video to sample. |
Returns
TextmodeTexture
The configurable texture source.
Example
const source = t.overlay.setTarget(canvas);
source.characters(' .:-=+*#%@');Visibility
Show, hide, and toggle only the output canvas while sampling continues.
hide()
hide(): void;Hide only the output canvas. Sampling and sketch execution continue.
Returns
void
Example
t.overlay.hide();isVisible()
isVisible(): boolean;Report the controller's intended output visibility.
Returns
boolean
Whether the output canvas is shown.
Example
if (t.overlay.isVisible()) t.overlay.hide();show()
show(): void;Show the output canvas and request a fresh geometry synchronization.
Returns
void
Example
t.overlay.show();toggle()
toggle(): void;Toggle output-canvas visibility.
Returns
void
Example
t.overlay.toggle();