textmode.synth.js / char
Function: char()
ts
function char(source): SynthSource;Create a character source from any color/pattern source.
This function converts any pattern (like osc(), noise(), voronoi()) into character indices. The pattern's luminance or color values are mapped to character indices.
Parameters
| Parameter | Type | Description |
|---|---|---|
source | SynthSource | A SynthSource producing color values that will be mapped to characters |
Returns
A new SynthSource configured for character generation
Example
javascript
const t = textmode.create({
width: window.innerWidth,
height: window.innerHeight,
plugins: [SynthPlugin],
});
t.layers.base.synth(
char(osc(6, 0.1, 1.2)).charMap('@#%*+=-:. ').charColor(osc(12, 0.05, 0.2))
);
t.windowResized(() => {
t.resizeCanvas(window.innerWidth, window.innerHeight);
});
@codex{ai-generated}Replace it with your own sketch, claim the credit, and climb the leaderboard.↗ View sketch on GitHub