Introducing a new way to review your PRs.

Read the announcement

bas3line / ascii

Animated ascii art for web pages, in TypeScript: React, Next.js, Astro, or one HTML tag

View on GitHub

21 documents · Updated Oct 26, 2026

docs / creative-kit-examples

Creative kit examples

The creative kit examples are a curated set of small animated programs. They show how the kit turns simple parts into reusable pieces across composition, drawing, fields, effects, particles, recipes, and geometry. Each example is also a checked sample that can play in the same places as other pieces.

Example purpose

The examples form a learning path from ready-made creative ideas to more direct control. They show the product goal of the kit: make expressive terminal and web art with readable descriptions, while keeping each result portable as one piece.

Example contract

Each example presents one visual idea as a default piece. A reader can inspect the short program, run it at set times, and compare its output in dark, paper, and one-ink views. The examples therefore teach both what a kit feature is for and how its result behaves as a piece.

The example set covers these learning steps:

  • Start with a recipe that makes a complete look, motion, or widget.
  • Combine existing pieces into a scene or a layout.
  • Draw directly on a grid when a recipe is not enough.
  • Add time-based fields, effects, particles, or geometry.
  • Export the result as a light or dark SVG when needed.

References: examples/…/recipe-looks-sea.ts• L1-7 scripts/…/show.ts• L27-80

Example lifecycle

The example lifecycle takes a source program through a shared viewer and checks the frame contract before it produces a visual or an SVG. This keeps the examples useful as both teaching material and product samples.

flowchart LR
    A[Example program] --> B[Kit piece]
    B --> C[Frame viewer]
    C --> D[Contract checks]
    C --> E[Dark, paper, or mono view]
    C --> F[Light or dark SVG]

The runner samples more than one time. It checks the declared size, allowed colors, repeatable frames, and expected animation. The full collection can then run in several display modes so a change does not only work in one theme or one color mode.

References: scripts/…/show.ts• L35-80 scripts/…/examples.ts• L19-42

Composition examples

Composition examples show how separate pieces become one visual arrangement. They focus on relationships between parts rather than on making a new renderer.

Layered scenes

Layered scenes place words and moving objects over a backdrop. compose-starfield.ts uses a quiet starfield behind a centered greeting and moves a small ship along the lower edge. compose-banner-scene.ts places a colored title over an ocean sunset. These examples show how a piece can remain visible through blank cells while another piece provides the setting.

References: examples/…/compose-starfield.ts• L14-23 examples/…/compose-banner-scene.ts• L8-14

Arranged and sequenced pieces

compose-dashboard.ts arranges four chart pieces in titled boxes. Each chart keeps its own behavior while the grid gives the whole display a shared shape. compose-logos.ts shows a different relationship: logos appear one after another and dissolve between steps. Together they cover persistent layouts and ordered presentations.

References: examples/…/compose-dashboard.ts• L8-19 examples/…/compose-logos.ts• L6-9

Drawing examples

Drawing examples show direct control over a piece’s visible grid. They use familiar visual forms to explain how text, shapes, plots, and pixel art can share one frame.

Grid drawing

draw-clock.ts builds a clock from a frame, a circle, labels, and hands. It shows placement by meaningful points and turns instead of a separate scene system. draw-gauge.ts combines a dial with a history plot, so a custom dashboard can show a current value and its recent movement together.

References: examples/…/draw-clock.ts• L10-23 examples/…/draw-gauge.ts• L12-28

Smooth plots and pixel motion

draw-sine.ts uses a braille canvas to make two smooth curves inside a titled frame. draw-sprite.ts uses a small two-frame figure that walks across a pixel surface. These examples mark the two main drawing styles: fine plot detail and block-based pixel animation.

References: examples/…/draw-sine.ts• L9-22 examples/…/draw-sprite.ts• L11-40

Field examples

Field examples turn a value for each cell into a whole picture. They demonstrate how a formula can describe light, motion, weather, or a surface without naming every character in the frame.

Formula-based pictures

field-sea.ts uses a moving surface and depth to show a rolling sea. field-storm.ts uses wind direction and strength to show a turning cyclone. field-pulse.ts shows a ring of light that expands and fades. Their shared lesson is that one field can control shape, density, character, color, and time.

References: examples/…/field-sea.ts• L11-27 examples/…/field-storm.ts• L10-24 examples/…/field-pulse.ts• L9-20

Fields inside compositions

field-window.ts places a lit ball inside a framed drawing and leaves room for a caption. It shows that a field is not only a complete piece. It can also supply one region of a larger design while the rest of the frame uses ordinary drawing.

References: examples/…/field-window.ts• L7-17

Effect examples

Effect examples show how a piece can gain a new visual behavior without changing its source. The same effect model works on text, banners, library pieces, and kit-made pieces.

Chained effects

fx-chain-card.ts types terminal commands, grows a rounded outline, and adds a shadow. fx-chain-banner.ts combines a rainbow color cycle with a wave. These examples show that effects form a readable sequence: each step receives the result of the step before it.

References: examples/…/fx-chain-card.ts• L7-16 examples/…/fx-chain-banner.ts• L6-9

Source-preserving effects

fx-dissolve-donut.ts, fx-glitch-logo.ts, and fx-scan-logo.ts apply distinct transitions to existing pieces. The source remains the subject while the effect controls how it appears. This makes effects suitable for branding, status displays, and transitions between states.

References: examples/…/fx-dissolve-donut.ts• L6-9 examples/…/fx-glitch-logo.ts• L6-9 examples/…/fx-scan-logo.ts• L5-8

Custom effects

fx-custom-reflection.ts demonstrates the extension point for a visual rule that is not built in. It keeps the source banner and adds a moving reflection below it. The example shows that custom effects can enlarge a piece and still behave like a normal kit result.

References: examples/…/fx-custom-reflection.ts• L7-20

Particle examples

Particle examples show many small objects that are born, move, age, and leave the frame. They cover both named presets and scenes where particles are part of a larger composition.

Preset systems

particles-snow.ts puts falling snow in front of a painted cabin. particles-confetti.ts launches colored pieces from two corners and lets them fall and bounce. These examples show how a named particle behavior can provide atmosphere or event motion with a small set of choices.

References: examples/…/particles-snow.ts• L8-20 examples/…/particles-confetti.ts• L9-18

Particles with named sources

particles-banner.ts makes sparks rise from the letters of a banner. particles-comet.ts draws a moving comet tail over stars and then places the comet body into the same frame. These examples show the two main relationships between particles and other art: particles can come from a marked source, or they can become one layer in a custom piece.

References: examples/…/particles-banner.ts• L7-14 examples/…/particles-comet.ts• L8-21

Recipe examples

Recipe examples present the shortest route to a complete result. They are curated by visual intent, so a new user can choose a sea, a moving object, or a widget before learning the lower-level drawing model.

Looks

The look examples cover named animated backgrounds and atmospheres. recipe-looks-sea.ts creates an ocean scene with one palette choice. recipe-looks-aurora.ts combines an aurora with sparse stars. recipe-looks-plasma.ts changes the palette and speed of a plasma. recipe-looks-matrix.ts uses a look as a background for a banner.

References: examples/…/recipe-looks-sea.ts• L5-7 examples/…/recipe-looks-aurora.ts• L5-7 examples/…/recipe-looks-plasma.ts• L5-8 examples/…/recipe-looks-matrix.ts• L5-8

Motion

Motion examples show that the same movement language can wrap many kinds of content. recipe-motion-orbit.ts moves a symbol around a banner. recipe-motion-hover.ts combines spinning and floating around a cube. recipe-motion-heartbeat.ts applies a pulse to a heart. The examples make motion a reusable relationship rather than a property tied to one shape.

References: examples/…/recipe-motion-orbit.ts• L5-8 examples/…/recipe-motion-hover.ts• L5-7 examples/…/recipe-motion-heartbeat.ts• L5-7

Widgets

Widget examples focus on useful displays that already have a visual structure. recipe-widget-dashboard.ts combines gauges, a sparkline, and a spinner. recipe-widget-card.ts turns text into a card and gives it a quiet motion. recipe-widget-progress.ts presents a repeating progress display. These samples connect kit art to status panels and product interfaces.

References: examples/…/recipe-widget-dashboard.ts• L5-8 examples/…/recipe-widget-card.ts• L5-7 examples/…/recipe-widget-progress.ts• L5-7

Geometry examples

Geometry examples show the kit’s ways to describe position and shape. They move from direct frame control to named 3D forms that handle lighting, depth, and orbit relationships.

Direct geometry

core-orbit.ts is the small reference for a hand-built orbit. It places a planet and moon in a repeating path and makes the moon pass behind the planet for part of the turn. The example is useful when a recipe is too narrow and the maker needs full control of the frame.

References: examples/…/core-orbit.ts• L8-18

Three-dimensional scenes

shapes3d-planet.ts uses two spheres, a named surface pattern, and a tilted orbit to make a planet and moon. shapes3d-orrery.ts adds a solar body, a visible orbit path, and a planet–moon group. These examples show the main purpose of 3D geometry: describe objects and their relationships while the scene supplies light, depth, and camera view.

References: examples/…/shapes3d-planet.ts• L6-11 examples/…/shapes3d-orrery.ts• L7-17

Change checklist

When these files or sections are changed, remember to consider these:

  • Keep every example’s default export as a playable piece so the shared runner can load it.
  • Keep declared frame size, palette use, and animation behavior aligned with the checks in scripts/…/show.ts.
  • When a composition combines loops, confirm that the combined result still has a useful repeat for SVG output.
  • When a new example uses a new kit area, place it in the matching examples/kit name group so the runner includes it.
  • If an example changes its visual theme, check the dark, paper, and mono runs because each uses a different rendering view.

Important failure modes

TriggerConsequenceGuard
A frame returns the wrong number of rows or columnsThe example fails the piece contract and cannot be trusted as a kit sampleRun the example through scripts/…/show.ts so each sampled frame is checked
A still piece changes between two reads at the same timeSVG and other repeatable players can show unstable outputKeep non-clock frames determined by their input time and use seeded variation
An animated example produces too few distinct framesThe sample claims motion but looks still to a playerRun the shared time samples and inspect the animation check
A palette index falls outside the declared colorsColor output can be invalid in canvas, terminal, or SVG viewsUse the piece palette contract and run paper and mono checks
A combined loop does not return in a practical timeSVG output has no clean loop or needs a fallback play windowSet a deliberate period for the composition when source loops do not meet soon

Key files

FileWhy to read it
examples/…/recipe-looks-sea.tsSmallest example of a named look and palette choice
examples/…/compose-dashboard.tsShows a multi-piece layout with titled cells and per-piece colors
examples/…/draw-gauge.tsShows custom drawing that combines a value display with history
examples/…/field-sea.tsShows a formula-based animated surface with custom characters
examples/…/fx-chain-card.tsShows effects applied in a readable sequence
examples/…/particles-comet.tsShows particles mixed with custom drawing in one piece
examples/…/shapes3d-planet.tsShows named 3D shapes, texture, lighting, and an orbit
scripts/…/show.tsDefines the shared frame checks and optional SVG output
scripts/…/examples.tsRuns the complete example set across display modes

The project website explains where these examples fit in the public documentation. The website experience covers how readers meet the examples. The creative coding kit explains the kit concepts that these programs demonstrate.