Moving pictures of ideas, written as code.

A vector animation engine and diagram library for TypeScript.

npm install vizmatic

This is not a video. Your browser is drawing these curves right now.v0.10.0, MIT licensed

Scroll. You are the timeline.

  1. A point goes around.

    Nothing here is pre-rendered. Scroll back up and it runs in reverse, because every frame is a pure function of time.

  2. Its height is a wave.

    Each sample of the curve is computed for the time your scrollbar sets, then drawn as vector paths.

  3. Add circles and it sharpens.

    Each new circle is the next odd harmonic. The sum above is typeset with real TeX glyphs, and no LaTeX install is needed.

  4. Enough circles can draw anything.

    A discrete Fourier transform of one letter's outline, played as 121 turning circles.

The whole film is this much code.

A film is a plain function. Each s.play writes keys on a timeline, and the highlighted line is the one playing now.

import { axes, dot, draw, dynamic, fadeIn, film, line, morphMatching, tex, write } from 'vizmatic/stage'

export default film({ title: 'The derivative, in a page of code' }, (s) => {
    const graph = s.add(axes({ x: [-1, 3.5], y: [-1, 9], width: 1120, height: 780, grid: true }))
    graph.at(-300, 20)
    s.play(draw(graph.grid), draw(graph.lines), fadeIn(graph.numbers))

    const parabola = graph.plot((x) => x * x, { stroke: 'blue', width: 5 })
    s.play(draw(parabola))

    const h = s.value(1.8)
    const secant = dynamic(() => {
        const y = (x: number) => 1 + (2 + h.value) * (x - 1)
        const moving = 1 + h.value
        return [
            line(graph.world(0, y(0)), graph.world(3, y(3)), { stroke: 'yellow', width: 4 }),
            dot(9, 'teal').at(graph.world(1, 1)),
            dot(9, 'yellow').at(graph.world(moving, moving ** 2)),
        ]
    })
    s.play(fadeIn(secant))

    const ratio = s.add(tex('\\frac{(1+h)^2 - 1}{h}', { size: 72 }).at(590, -160))
    s.play(write(ratio))

    const result = tex('2 + h', { size: 88, color: 'yellow' }).at(590, -160)
    s.play(morphMatching(ratio, result))

    s.play(h.to(0.02, { duration: 3.5 }))
    s.wait(1.5)
})

Press the space bar to pause. Tap play/pause or dragDrag the bar to seek. Both directions are instant.

Grab it. It is still just math.

Because a frame is computed when it is needed, a film can take input. These two run on the same engine as every film here.

1.000.000.001.00

Drag the tips of the two arrows on the plane. They are the columns of the matrix, and the whole grid follows them.

determinant1.00
trace2.00

Films, with their source.

Five live scenes, computed frame by frame in your browser as you scroll. Open any film for chapters, the TypeScript source, and an MP4.

Figures, not slides.

The diagram library packs a page of information into a frame, with type and rules at print density. Ask for larger when you are presenting.

A dense production system map with services, data stores, regions, ports, and live metrics
A production system on one page: services, boundaries, ports, protocols, and live numbers.All rendered examples

What is different.

Start with one curve.

npm install vizmatic
npx vizmatic film ./my-film.ts --out ./out

Search

↑ ↓ to navigateEnter to openEsc to close
Editable TSX

Example source

Open in the builder

Open the builder to edit this scene, preview animations, and export your visual.

Example preview