charGrid

The character grid: which cell each pixel falls in, and where it sits inside that cell.

charGrid(slots: {cellSize: PropRef; spacing: PropRef}): FragmentStage

Import effects from shaders/std and use effects.stylize.charGrid.

cellSize is the cell size in pixels on a 1080-pixel-tall canvas; it scales with the canvas height. spacing is how much of the cell the character fills (1 fills it). Build it once and share it with cellSample, glyphFor and glyphTint.

Parameters

NameTypeNotes
slots{cellSize: PropRef; spacing: PropRef}

Example

const grid = charGrid({cellSize: p('cellSize'), spacing: p('spacing')})

See also

  • cellSample — The color of the layer inside at the centre of each character cell.
  • glyphFor — The character drawn in each cell, picked by how bright the cell is.
  • glyphTint — The finished ASCII look: each character tinted with its cell's color, everything else transparent.

Used by

Ascii