Skip to content

textmode.synth.js / paint

Function: paint()

Call Signature

ts
function paint(source): SynthSource;

Create a synth source with both character and cell colors defined.

This function creates a SynthSource where both the character foreground color and the cell background color are driven by the same source pattern.

Accepts either a SynthSource (pattern) or RGBA values (solid color).

Parameters

ParameterTypeDescription
sourceSynthSourceA SynthSource producing color values

Returns

SynthSource

A new SynthSource configured with both color sources

Example

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

t.layers.base.synth(paint(osc(10, 0.1, 1.2).kaleid(4)).char(noise(6)));

t.windowResized(() => {
	t.resizeCanvas(window.innerWidth, window.innerHeight);
});
codex avatar
@codex{ai-generated}Replace it with your own sketch, claim the credit, and climb the leaderboard.View sketch on GitHub

Call Signature

ts
function paint(
   r, 
   g?, 
   b?, 
   a?): SynthSource;

Create a synth source with both character and cell colors defined using RGBA values.

Parameters

ParameterTypeDescription
rSynthParameterValueRed channel (0-1) or value
g?SynthParameterValueGreen channel (0-1) or value
b?SynthParameterValueBlue channel (0-1) or value
a?SynthParameterValueAlpha channel (0-1) or value

Returns

SynthSource

A new SynthSource configured with both color sources

Example

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

t.layers.base.synth(paint(0.9, 0.8, 0.7).char(osc(6, 0.1, 0.5)));

t.windowResized(() => {
	t.resizeCanvas(window.innerWidth, window.innerHeight);
});
codex avatar
@codex{ai-generated}Replace it with your own sketch, claim the credit, and climb the leaderboard.View sketch on GitHub

Call Signature

ts
function paint(gray): SynthSource;

Create a synth source with both character and cell colors defined using a grayscale value.

Parameters

ParameterTypeDescription
graySynthParameterValueGrayscale value (0-1)

Returns

SynthSource

Example

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

t.layers.base.synth(paint(0.3).char(noise(7)));

t.windowResized(() => {
	t.resizeCanvas(window.innerWidth, window.innerHeight);
});
codex avatar
@codex{ai-generated}Replace it with your own sketch, claim the credit, and climb the leaderboard.View sketch on GitHub