Skip to content

textmode.js ​

Build real-time ASCII and textmode graphics in the browser with a grid-based WebGL2 drawing interface. Create a textmode drawing context, then compose characters, colors, shapes, media, layers, and effects on its grid.

Start a sketch ​

javascript
const t = textmode.create({
  width: window.innerWidth,
  height: window.innerHeight,
  fontSize: 16
});

t.draw(() => {
  t.background(8);
  t.char('@');
  t.charColor(255, 180, 80);
  t.point();
});

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

Sketch workflow ​

  1. Create the drawing context with textmode.create.
  2. Load or configure resources in Textmodifier.setup.
  3. Draw the base scene in Textmodifier.draw.
  4. Add layers, media conversion, plugins, or shaders when the sketch needs them.
  5. Respond to resize and input events as the sketch runs.

Read the first sketch guide, fundamentals, and examples for guided learning; use Textmodifier for the complete drawing interface.

Conversion ​

Convert visual sources into textmode data and post-process the result.

NamespaceDescription
conversionAll media conversion related modules and types.

Core workflow ​

Create, configure, and run a textmode sketch.

NameDescription
textmodeThe main entry point for the textmode.js library.
TextmodifierThe main textmode.js drawing context.
TextmodeOptionsOptions when creating a Textmodifier instance via textmode.create.

Creative coding utilities ​

Use deterministic randomness and vector math in generative sketches.

ClassDescription
TextmodeRandomA deterministic pseudo-random number generator for textmode sketches.
TextmodeVectorMutable two- or three-dimensional vector for creative-coding math.

Drawing & 3D ​

Draw primitives and control the camera used for spatial scenes.

NameDescription
ShapeAssemblyModeShape assembly modes for Textmodifier.beginShape.
TextmodeCameraMutable camera object used for p5-style camera workflows.

Fonts & media ​

Load glyph sources and use images, video, and live textures.

NamespaceDescription
fontsAll font rendering related modules and types.
mediaAll media asset related modules and types.

Grid, glyphs & color ​

Define the cell-based visual language of a sketch.

NameDescription
colorColor objects, color modes, and types.
TextmodeGlyphRampImmutable character sequence for mapping numbers to glyphs.
TextmodeGridGrid used by a textmode layer.
GridPositionPosition on a grid, typically in center-based coordinates.

Interaction ​

Respond to keyboard, mouse, touch, and gamepad input.

NamespaceDescription
inputAll types and interfaces related to input event handling.

Layers & GPU rendering ​

Compose scenes and work with GPU-backed drawing resources.

NameDescription
layeringAll modules and types related to multi-layered textmode rendering.
TextmodeFramebufferFramebuffer class for managing offscreen rendering targets initialized via Textmodifier.createFramebuffer.
TextmodeShaderWebGL shader program created by Textmodifier.createMaterialShader or Textmodifier.createShader.
TextmodeFramebufferOptionsOptions for creating a framebuffer via Textmodifier.createFramebuffer. If not specified, width and height default to the current textmode grid size.
TextmodeUniformValueValues accepted by custom shader uniforms.

Loading & errors ​

Control loading feedback and diagnose runtime failures.

NamespaceDescription
errorsAll error handling related modules and types.
loadingAll loading screen related modules and types.

Plugins ​

Extend runtime instances and the sketch lifecycle.

NamespaceDescription
pluginsPlugin system types for extending textmode.js functionality.