textmode.synth.js / SynthSource
Class: SynthSource
A chainable synthesis source that accumulates transforms to be compiled into a shader.
This is the core class that enables hydra-like method chaining for generating procedural textmode visuals. Each method call adds a transform to the chain, which is later compiled into a GLSL shader.
Example
Methods
| Method | Description |
|---|---|
| charMap | Map character indices to a specific character set. This is the primary textmode-native way to define which characters to use. |
| charColor | Set the character foreground color using a color source chain. |
| char | Set the character indices using a character source chain. The number of characters is determined by charMap() if defined, otherwise falls back to the total characters in the layer's font. |
| cellColor | Set the cell background colors using a color source chain. |
| paint | Set both character foreground and cell background color using the same source chain. This is a convenience method that combines .charColor() and .cellColor() in one call. |
| clone | Create a deep clone of this SynthSource. Useful when you want to create a modified version of an existing chain without affecting the original. |
| brightness | Adjust brightness. |
| contrast | Adjust contrast. |
| invert | Invert colors. |
| saturate | Adjust color saturation. |
| hue | Shift hue. |
| colorama | Apply colorama effect (hue rotation based on luminance). |
| posterize | Posterize colors to limited palette. |
| luma | Apply threshold based on luminance. |
| thresh | Apply hard threshold. |
| color | Multiply all channels by a scalar value (grayscale). |
| r | Extract the red channel as a grayscale value. |
| g | Extract the green channel as a grayscale value. |
| b | Extract the blue channel as a grayscale value. |
| shift | Shift color channels by adding offset values. |
| gamma | Apply gamma correction for nonlinear brightness control. |
| levels | Adjust input/output levels and gamma for precise tonal control. |
| clamp | Clamp color values to a specified range for stability. |
| seed | Set a seed for deterministic randomness in this source chain. |
| add | Add another source. |
| sub | Subtract another source. |
| mult | Multiply with another source. |
| blend | Blend with another source. |
| diff | Difference with another source. |
| layer | Layer another source on top. |
| mask | Mask using another source. |
| screen | Screen blend with another source. |
| overlay | Overlay blend with another source. |
| softlight | Soft light blend with another source. |
| hardlight | Hard light blend with another source. |
| dodge | Color dodge blend with another source. |
| burn | Color burn blend with another source. |
| lighten | Lighten blend with another source. |
| darken | Darken blend with another source. |
| modulate | Modulate coordinates using another source. |
| modulateScale | Modulate scale using another source. |
| modulateRotate | Modulate rotation using another source. |
| modulatePixelate | Modulate pixelation using another source. |
| modulateKaleid | Modulate kaleidoscope using another source. |
| modulateScrollX | Modulate X scroll using another source. |
| modulateScrollY | Modulate Y scroll using another source. |
| modulateRepeat | Modulate repeat pattern with another source. |
| modulateRepeatX | Modulate X repeat with another source. |
| modulateRepeatY | Modulate Y repeat with another source. |
| modulateHue | Modulate coordinates based on hue differences. |
| rotate | Rotate coordinates. |
| scale | Scale coordinates. |
| scroll | Scroll coordinates in both X and Y directions. |
| scrollX | Scroll coordinates in X direction. |
| scrollY | Scroll coordinates in Y direction. |
| pixelate | Pixelate the output. |
| repeat | Repeat coordinates in both X and Y directions. |
| repeatX | Repeat coordinates in X direction. |
| repeatY | Repeat coordinates in Y direction. |
| kaleid | Apply kaleidoscope effect. |
| polar | Convert coordinates to polar space. |
| twirl | Twirl distortion with radial falloff. |
| swirl | Swirl distortion around a center. |
| mirror | Mirror coordinates across X and/or Y axes. |
| shear | Shear coordinates along X and Y axes. |
| barrel | Barrel distortion (bulge outward). |
| pinch | Pinch distortion (pull inward). |
| fisheye | Fisheye lens distortion. |
| osc | Generate oscillating patterns using sine waves. |
| noise | Generate Perlin noise patterns. |
| plasma | Generate plasma-like sine field patterns. |
| moire | Generate moire interference patterns. |
| voronoi | Generate voronoi patterns. |
| gradient | Generate a rotating radial gradient. |
| shape | Generate geometric shapes (polygons). |
| solid | Generate a solid grayscale color. |
| src | Sample the previous frame for feedback effects. |