textmode.synth.js / src
Function: src()
ts
function src(source?): SynthSource;Sample a source for synth compositions.
This is the core of feedback loops and source sampling - it reads from various sources, enabling effects like trails, motion blur, image processing, and recursive patterns.
Three modes of operation:
Self-feedback (
src()with no arguments): Samples from the previous frame- Context-aware: automatically samples the appropriate texture based on compilation context
- Inside
char(...)→ samples previous frame's character data - Inside
charColor(...)→ samples previous frame's primary color - Inside
cellColor(...)→ samples previous frame's cell color
Cross-layer sampling (
src(layer)): Samples from another layer's output- Enables hydra-style multi-output compositions
- Context-aware based on current compilation target
TextmodeSource sampling (
src(image)orsrc(video)): Samples from loaded media- Works with TextmodeImage and TextmodeVideo loaded via
t.loadImage()ort.loadVideo() - Samples directly from the source texture
- Works with TextmodeImage and TextmodeVideo loaded via
Equivalent to hydra's src(o0).
Parameters
| Parameter | Type | Description |
|---|---|---|
source? | | TextmodeSource | TextmodeLayer | (() => TextmodeSource | TextmodeLayer | undefined) | Optional source to sample from: TextmodeLayer for cross-layer, or TextmodeImage/TextmodeVideo for media |
Returns
A new SynthSource that samples the specified source or self