Skip to content

Intermact API Reference

This overview covers the architecture and entry points for v0.1–v1.0 (Phase-1 / Phase-2 / Phase-3) public API; individual symbol pages are generated by TypeDoc from exports and TSDoc comments in packages/*/src. Phase-3 (PCG / 3D / serialization export / plugins) API map is in §Phase-3 below; concept guides at PCG / 3D / Export & embed / Performance / Extensibility.

Full contract and revision history in repo dev-docs/design.md. Conceptual tutorial: Guide · Architecture overview.

Vision and API boundaries

PhaseVersionThemeRelation to this doc
Phase-1v0.1Interactive Manim alternative: 2D primitives, seekable timeline, coordinate axes, reactive tuningOverview §Phase-1
Phase-2v0.2Math toolbox: Scale, LaTeX, Morph matching, interaction picking, layoutOverview §Phase-2
Phase-3v1.0PCG, full 3D, serialization/export/embed, pluginsSymbol pages + Plugin guide

Core execution model: seekable timeline

Intermact uses a retained-mode timeline (design.md §3.2):

PhaseResponsibilityKey API
BuildRegister objects; scene.play appends tracks to StoryboardcreateProgram, buildProgram, Scene2D
Playbackseek / update pure-function evaluation; deterministic snapshotPlayer, Track, RenderSnapshot

await scene.play(...) is build-time syntax sugar: logical clock advances instantly, no wall-clock time consumed.

Object three layers: definition · instance · runtime state

text
IMObject2D (immutable definition: geometry + trait)
    └── scene.register(...) → RegisteredObject2D (animation handle: create / moveTo / morphTo …)
            └── Track evaluation → RuntimeState2D (position, reveal, opacity, geometryOverride …)

Scene · Camera · Canvas decoupling

Unlike Manim, scene, camera, and canvas are layered (design.md §9–10):

LayerRoleKey API
Scene2DCoordinate domain, object registration, getAxes, orchestrates playScene2D
CameraOrthographic camera description, mounted to viewportcreateCamera2D
CanvasReact entry: build program, R3F canvas, timeline overlayIntermactCanvas

Coordinate transforms: CoordinateTransform2D (abs/rel, polar). Axis objects register via Scene2D.getAxes; ticks generated by Scale (Phase-2).

Package layers and render pipeline

text
@intermact/react
  └── @intermact/render-r3f     SceneView, computeFit
        └── @intermact/render-three   stroke/fill geometry, ThreeSceneView
              └── @intermact/core     no React / three / DOM
PackageResponsibility
@intermact/coreModel, geometry, timeline, reactive, Scale/constructs/text/interaction; headless in Node
@intermact/render-threeRenderSnapshot → three.js geometry (stroke trim, earcut fill)
@intermact/render-r3fR3F diff update, camera fit, HiDPI
@intermact/reactIntermactCanvas, useSignal, timeline controls, Inspector

Data flow: Player.getSnapshot()ThreeSceneView diff → R3F SceneView.


Phase-1 (v0.1): basic 2D narrative

Guides: Program and scene · Timeline · Geometry · Rendering · Animation · Coordinates · Reactive

CapabilityAPI entry
2D primitivescircle, rectangle, polygon, bezierCurve, arrow
Create / Fade / Move / TweenRegisteredObject2D, compileSpec
Orchestrationsequence, parallel, stagger, wait
Coordinates and axesCoordinateTransform2D, Scene2D.getAxes
Reactive tuningsignal, derived, tweenSignal, useSignal
Side effects (not seekable)call

Phase-2 (v0.2): math toolbox

Guides: Scale · Math constructs · Morph · Text and LaTeX · Interaction · Layout and Inspector

Scale and ticks (M7)

CapabilityAPI entry
Scale typeslinearScale, logScale, normalizeScale
Tick generationnumericTicks
Axis handlecreateAxesHandle, AxesHandle (c2p / xScale / yScale)

Math construct library (M8)

CapabilityAPI entry
Coordinate planesnumberLine, numberPlane, polarPlane, complexPlane
Curves and integrationfunctionGraph, parametricGraph, areaUnderCurve, riemannRectangles, tangentLine
Expression and annotationmatrixObject, tableObject, brace, decimalNumber

Morph and part matching (M9)

StrategyAPI entry
arc-length / anchor / matching / cross-fademorph, transformMatching
Composite object part keysgroup2D
Instance methodsRegisteredObject2D.morphTo, transformMatchingTo

Text and LaTeX (M10)

CapabilityAPI entry
FontsloadOutlineFontFromBuffer, setDefaultFont, createAssetManager
Text objectstextObject, glyphText
LaTeXlayoutMathJaxLatex, latexObjectFromGlyphs
Writing animationglyphLocalReveal, computeGlyphRevealSpans
Formula part morphtransformMatchingTex (token → part key, reuses matching)

Interaction system (M11)

CapabilityAPI entry
Draggable sourcesdraggablePoint, draggableValue, draggablePointSource, draggableValueSource
Hit testinghitTest, hitProxy, interactive
Pick helperspickRectFromObject, pickBandFromObject

Layout and Inspector (M12)

CapabilityAPI entry
Relative layoutLayoutHandle (RegisteredObject2D.layout: alignTo / nextTo / arrange / fitTo)
Layout handle factorycreateLayoutHandle
Dev toolsInspector (React-side scene tree / signals / snapshot debug)

Phase-3 (v1.0): PCG · 3D · serialization export · plugins

Guides: Procedural generation · 3D scenes and cameras · Export, share, and embed · Performance and big data · Extensibility

PCG procedural generation (M13)

CapabilityAPI entry
Parametric / lattice / tilingparametricCurve2D, lattice, tiling
Fractal / rulesfractal, recursiveTree, lSystem, cellularAutomaton, cellularAutomatonFrames
FieldsfunctionGraph, isoline, heatmap, streamlines
Graph / datagraphObject, barChart, scatter, lineChart, mapData
Combinator operatorstransformObject, repeatObject, instanceField, mapPoints, along, booleanOp

Full 3D (M14)

CapabilityAPI entry
Scene / cameraScene3D, RegisteredCamera3D, CoordinateTransform3D
3D factoriespolyline3D, curve3D, meshObject, surface3D, pointCloud3D, axes3D
Scalar field isosurfaceisosurface, marchingCubes
Nested sub-scenesRegisteredObject2D.layout · render(scene, camera) (render-r3f RenderedScene)

Serialization / export / embed (M15)

CapabilityAPI entry
Serializationserialize, deserialize
Share linksencodeShareUrl, decodeShareUrl, SerializedCanvas
Headless framessnapshotToSVG, sampleFrames, sampleFrameHashes
Video / GIFrecordCanvasVideo, captureFrameSequencePng, encodeGif, exportCanvasGif
EmbeddefineIntermactEmbed, buildEmbedIframe

Performance and extensibility (M16 / M17)

CapabilityAPI entry
GPU instancing / point cloudinstanceField, pointCloud3D
RegistriescreateRegistries, globalRegistries
PluginsdefinePlugin, installPlugin, defineObjectType, defineGenerator
Generator dispatchrunGenerator, selectRenderer

Reactive layer (interactive state)

Aligned with Manim ValueTracker + add_updater (design.md §8), for parameter-driven geometry recomputation:

Each frame: Player.prepareFrameReactiveEngine.flush → then generate RenderSnapshot.

How to browse symbols

  1. Enter package index pages from Packages below.
  2. Sidebar browse by Classes / Interfaces / Functions (includes all Phase-2 exports).
  3. To change API docs, edit source TSDoc and run pnpm run gen:reference to regenerate.

Packages

Intermact v1.0 — docs cover Phase-1 / Phase-2 / Phase-3 (all stages)