Skip to content

textmode.synth.js

A derivative work of hydra-synth by Olivia Jack, adapted for the textmode.js ecosystem, providing a visual synthesis system for procedural generation of characters, colors, and visual effects through method chaining.

Example

javascript
const t = textmode.create({
  width: window.innerWidth,
  height: window.innerHeight,
  plugins: [SynthPlugin]
});

const synth = noise(8)
  .rotate(0.2)
  .kaleid(5)
  .charColor(osc(6, 0.1, 1.2))
  .cellColor(osc(6, 0.1, 1.2).invert())
  .charMap('@#%*+=-:. ');

t.layers.base.synth(synth);

t.windowResized(() => {
  t.resizeCanvas(window.innerWidth, window.innerHeight);
});

Classes

ClassDescription
SynthSourceA chainable synthesis source that accumulates transforms to be compiled into a shader.

Interfaces

InterfaceDescription
SynthContextContext passed to dynamic parameter functions during rendering.
ModulatedArrayExtended array interface with modulation methods.

Type Aliases

Type AliasDescription
SynthParameterValueDynamic parameter value types supported by the synth system.
EasingFunctionEasing functions from https://gist.github.com/gre/1650294
DynamicErrorCallbackCallback signature for dynamic parameter evaluation errors. Live coding environments can use this to display errors without interrupting rendering.

Variables

VariableDescription
SynthPluginThe textmode.synth.js plugin to install.

Functions

FunctionDescription
cellColorCreate a synth source with cell background color defined.
charCreate a character source from any color/pattern source.
charColorCreate a synth source with character foreground color defined.
gradientGenerate a rotating radial gradient.
noiseGenerate Perlin noise patterns.
plasmaGenerate plasma-like sine field patterns.
moireGenerate moire interference patterns.
oscGenerate oscillating patterns using sine waves.
paintCreate a synth source with both character and cell colors defined.
shapeGenerate geometric shapes (polygons).
solidGenerate a solid grayscale color.
srcSample a source for synth compositions.
voronoiGenerate voronoi patterns.
setGlobalErrorCallbackSet a global error callback for dynamic parameter evaluation errors.