Skip to content

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

MethodDescription
charMapMap character indices to a specific character set. This is the primary textmode-native way to define which characters to use.
charColorSet the character foreground color using a color source chain.
charSet 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.
cellColorSet the cell background colors using a color source chain.
paintSet 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.
cloneCreate a deep clone of this SynthSource. Useful when you want to create a modified version of an existing chain without affecting the original.
brightnessAdjust brightness.
contrastAdjust contrast.
invertInvert colors.
saturateAdjust color saturation.
hueShift hue.
coloramaApply colorama effect (hue rotation based on luminance).
posterizePosterize colors to limited palette.
lumaApply threshold based on luminance.
threshApply hard threshold.
colorMultiply all channels by a scalar value (grayscale).
rExtract the red channel as a grayscale value.
gExtract the green channel as a grayscale value.
bExtract the blue channel as a grayscale value.
shiftShift color channels by adding offset values.
gammaApply gamma correction for nonlinear brightness control.
levelsAdjust input/output levels and gamma for precise tonal control.
clampClamp color values to a specified range for stability.
seedSet a seed for deterministic randomness in this source chain.
addAdd another source.
subSubtract another source.
multMultiply with another source.
blendBlend with another source.
diffDifference with another source.
layerLayer another source on top.
maskMask using another source.
screenScreen blend with another source.
overlayOverlay blend with another source.
softlightSoft light blend with another source.
hardlightHard light blend with another source.
dodgeColor dodge blend with another source.
burnColor burn blend with another source.
lightenLighten blend with another source.
darkenDarken blend with another source.
modulateModulate coordinates using another source.
modulateScaleModulate scale using another source.
modulateRotateModulate rotation using another source.
modulatePixelateModulate pixelation using another source.
modulateKaleidModulate kaleidoscope using another source.
modulateScrollXModulate X scroll using another source.
modulateScrollYModulate Y scroll using another source.
modulateRepeatModulate repeat pattern with another source.
modulateRepeatXModulate X repeat with another source.
modulateRepeatYModulate Y repeat with another source.
modulateHueModulate coordinates based on hue differences.
rotateRotate coordinates.
scaleScale coordinates.
scrollScroll coordinates in both X and Y directions.
scrollXScroll coordinates in X direction.
scrollYScroll coordinates in Y direction.
pixelatePixelate the output.
repeatRepeat coordinates in both X and Y directions.
repeatXRepeat coordinates in X direction.
repeatYRepeat coordinates in Y direction.
kaleidApply kaleidoscope effect.
polarConvert coordinates to polar space.
twirlTwirl distortion with radial falloff.
swirlSwirl distortion around a center.
mirrorMirror coordinates across X and/or Y axes.
shearShear coordinates along X and Y axes.
barrelBarrel distortion (bulge outward).
pinchPinch distortion (pull inward).
fisheyeFisheye lens distortion.
oscGenerate oscillating patterns using sine waves.
noiseGenerate Perlin noise patterns.
plasmaGenerate plasma-like sine field patterns.
moireGenerate moire interference patterns.
voronoiGenerate voronoi patterns.
gradientGenerate a rotating radial gradient.
shapeGenerate geometric shapes (polygons).
solidGenerate a solid grayscale color.
srcSample the previous frame for feedback effects.