Documentation
¶
Overview ¶
Package goanim is a Go library for producing animated videos of system-design and mathematical / educational content. The visual style ranges from the hand-drawn aesthetic of Excalidraw to clean AWS-architecture-diagram crispness, all controlled by an orthogonal style system that lets callers set the look once and stamp the same diagram in any aesthetic.
goanim is conceptually adjacent to Manim, but with a different visual style, an explicit layout-helpers stance (compose, do not compute coordinates), and pure-Go LaTeX rendering — no external TeX installation required.
Package layout ¶
- core/scene — Scene, the timeline/camera/mobject root.
- core/mobject — Mobject interface plus primitive shapes.
- core/animation — Animation primitives and combinators.
- core/render — Rasterizer backends and the MP4 encoder.
- core/layout — HBox/VBox/Grid/Stack/Padding/AlignTo helpers.
- core/direction — Camera, laser pointer, pulse, spotlight, annotations.
- core/style — Five preset stylesheets (Excalidraw, Sketchy, Crisp, ...).
- core/rough — Hand-drawn / sketchy stroke engine (temporally stable).
- core/geometry — Pt, BBox, transforms.
- core/icon — Attachable contract for arrow routing.
- mobjects/icons — 39 system-design icons (compute, storage, network, ...).
- mobjects/mathx — Equation, NumberLine, Axes, Graph (pure-Go LaTeX).
- mobjects/systemdesign — Higher-level system-design composites.
- mobjects/netgraph — Network topology layouts.
Getting started ¶
See the examples/ directory for runnable programs that demonstrate scene construction, animation composition, and MP4 output. The smallest end-to-end example is examples/animated_diagram.
External tools ¶
MP4 encoding shells out to ffmpeg (libx264). LaTeX rendering is fully in-process via tdewolff/canvas + star-tex.org/x/tex, no host TeX install required.
Directories
¶
| Path | Synopsis |
|---|---|
|
cmd
|
|
|
bench
command
Command bench is the Phase-8 benchmark runner.
|
Command bench is the Phase-8 benchmark runner. |
|
bench/scenes
Package scenes is the Phase-8 benchmark scene catalog: three representative goanim workloads (small / medium / large) that the bench runner exercises in both crisp and sketchy styles.
|
Package scenes is the Phase-8 benchmark scene catalog: three representative goanim workloads (small / medium / large) that the bench runner exercises in both crisp and sketchy styles. |
|
core
|
|
|
animation
Package animation provides goanim's animation primitives: typed interpolators (FadeIn, MoveTo, DrawOn, ...) and composite combinators (Sequence, Parallel, Stagger).
|
Package animation provides goanim's animation primitives: typed interpolators (FadeIn, MoveTo, DrawOn, ...) and composite combinators (Sequence, Parallel, Stagger). |
|
animation/easing
Package easing provides curve functions used to shape animations.
|
Package easing provides curve functions used to shape animations. |
|
direction
Package direction provides goanim's "direction layer" — primitives that direct the viewer's attention rather than render new content.
|
Package direction provides goanim's "direction layer" — primitives that direct the viewer's attention rather than render new content. |
|
geometry
Package geometry provides primitive vector types and operations used throughout goanim: points, paths (sequences of move/line/cubic commands), affine transforms, and axis-aligned bounding rectangles.
|
Package geometry provides primitive vector types and operations used throughout goanim: points, paths (sequences of move/line/cubic commands), affine transforms, and axis-aligned bounding rectangles. |
|
icon
Package icon defines goanim's generic icon abstraction: a mobject type that draws a recognizable system-design concept (a queue, a cache, etc.) by composing style-aware primitives.
|
Package icon defines goanim's generic icon abstraction: a mobject type that draws a recognizable system-design concept (a queue, a cache, etc.) by composing style-aware primitives. |
|
layout
Package layout provides compositional positioning primitives — HBox, VBox, Grid, Stack, Padding, AlignTo — that let users build diagrams declaratively without computing pixel coordinates.
|
Package layout provides compositional positioning primitives — HBox, VBox, Grid, Stack, Padding, AlignTo — that let users build diagrams declaratively without computing pixel coordinates. |
|
mobject
Package mobject defines the "mathematical object" abstraction goanim uses to compose drawings.
|
Package mobject defines the "mathematical object" abstraction goanim uses to compose drawings. |
|
render
Package render defines the renderer abstraction used by mobjects to draw themselves, and provides a concrete raster backend built on github.com/tdewolff/canvas.
|
Package render defines the renderer abstraction used by mobjects to draw themselves, and provides a concrete raster backend built on github.com/tdewolff/canvas. |
|
rough
Package rough is goanim's roughness engine: a deterministic reimplementation of the algorithms from rough.js (https://github.com/rough-stuff/rough), adapted for Go and for the temporal-stability requirements of an animation system.
|
Package rough is goanim's roughness engine: a deterministic reimplementation of the algorithms from rough.js (https://github.com/rough-stuff/rough), adapted for Go and for the temporal-stability requirements of an animation system. |
|
scene
Package scene hosts the Scene struct — the timeline, camera, and mobject set that drive video output.
|
Package scene hosts the Scene struct — the timeline, camera, and mobject set that drive video output. |
|
style
Package style is goanim's style system: a set of independent attributes (Sloppiness, Edges, FillStyle, StrokeStyle, colors, font, opacity) that every mobject carries, resolved through a three-layer inheritance chain (library defaults → scene default → per-mobject override) at render time.
|
Package style is goanim's style system: a set of independent attributes (Sloppiness, Edges, FillStyle, StrokeStyle, colors, font, opacity) that every mobject carries, resolved through a three-layer inheritance chain (library defaults → scene default → per-mobject override) at render time. |
|
examples
|
|
|
01_hello_world
command
Command hello_world is the smallest possible goanim program.
|
Command hello_world is the smallest possible goanim program. |
|
02_animations
command
Command animations is a guided tour of goanim's core animation primitives.
|
Command animations is a guided tour of goanim's core animation primitives. |
|
03_styles
command
Command preset_gallery renders the same Client → Server → Database diagram in each of goanim's named style presets, producing one PNG per preset.
|
Command preset_gallery renders the same Client → Server → Database diagram in each of goanim's named style presets, producing one PNG per preset. |
|
04_layouts
command
Command layout_demo renders a static PNG showing nested layout containers.
|
Command layout_demo renders a static PNG showing nested layout containers. |
|
05_icons
command
Command icon_contact_sheet renders every generic icon under every sloppiness level, producing a single PNG grid for visual review.
|
Command icon_contact_sheet renders every generic icon under every sloppiness level, producing a single PNG grid for visual review. |
|
06_math
command
Command math_demo renders the Phase-4 math deliverable: equations, number lines, and a coordinate plane with a plotted function.
|
Command math_demo renders the Phase-4 math deliverable: equations, number lines, and a coordinate plane with a plotted function. |
|
07_system_diagram
command
Command animated_system_diagram builds a non-trivial system-design diagram composed entirely through layout helpers (no manual coordinates beyond the scene origin), connects components with smart-routed arrows of mixed types, and animates a multi-hop packet flowing through the diagram.
|
Command animated_system_diagram builds a non-trivial system-design diagram composed entirely through layout helpers (no manual coordinates beyond the scene origin), connects components with smart-routed arrows of mixed types, and animates a multi-hop packet flowing through the diagram. |
|
08_camera_direction
command
Command direction_demo is the Phase-7 foundation integration test: a short video exercising Pause + Camera (ZoomTo, Focus, Reset) + LaserPointer in both crisp and sketchy.
|
Command direction_demo is the Phase-7 foundation integration test: a short video exercising Pause + Camera (ZoomTo, Focus, Reset) + LaserPointer in both crisp and sketchy. |
|
09_full_explainer
command
Command url_shortener is the Phase-7 integration test: a 90-second scripted teaching video that exercises every direction-layer primitive in real-world combinations.
|
Command url_shortener is the Phase-7 integration test: a 90-second scripted teaching video that exercises every direction-layer primitive in real-world combinations. |
|
showcase
command
Command showcase renders goanim's promotional video — a tour of the library's capabilities.
|
Command showcase renders goanim's promotional video — a tour of the library's capabilities. |
|
internal
|
|
|
color
Package color provides the Excalidraw color palette used throughout goanim.
|
Package color provides the Excalidraw color palette used throughout goanim. |
|
latex
Package latex compiles LaTeX math formulas to goanim Path primitives via tdewolff/canvas's pure-Go LaTeX parser, with on-disk caching for fast iteration.
|
Package latex compiles LaTeX math formulas to goanim Path primitives via tdewolff/canvas's pure-Go LaTeX parser, with on-disk caching for fast iteration. |
|
mobjects
|
|
|
gridbg
Package gridbg provides a dark-theme grid background mobject — a subtle grid of thin gray lines on a black canvas.
|
Package gridbg provides a dark-theme grid background mobject — a subtle grid of thin gray lines on a black canvas. |
|
icons
Package icons is goanim's curated set of generic system-design icons (Client, Server, Database, Queue, Stack, Cache, LoadBalancer, MessageBroker, Worker, APIGateway, CDN, User, Service, Function, Storage).
|
Package icons is goanim's curated set of generic system-design icons (Client, Server, Database, Queue, Stack, Cache, LoadBalancer, MessageBroker, Worker, APIGateway, CDN, User, Service, Function, Storage). |
|
mascot
Package mascot is a tiny cartoon "host" character for explainer videos.
|
Package mascot is a tiny cartoon "host" character for explainer videos. |
|
mathx
Package mathx provides math-rendering mobjects: LaTeX equations, number lines, 2D coordinate axes, and plotted functions.
|
Package mathx provides math-rendering mobjects: LaTeX equations, number lines, 2D coordinate axes, and plotted functions. |
|
netgraph
Package netgraph provides labeled-circle nodes and connecting edges for graph-theory visualizations — social networks, microservice maps, state-machine-like topologies.
|
Package netgraph provides labeled-circle nodes and connecting edges for graph-theory visualizations — social networks, microservice maps, state-machine-like topologies. |
|
nqueens
Package nqueens provides the visual primitives for the "Explaining N-Queens" video: the chessboard grid, queen pieces, and attack-ray overlays.
|
Package nqueens provides the visual primitives for the "Explaining N-Queens" video: the chessboard grid, queen pieces, and attack-ray overlays. |
|
systemdesign
Package systemdesign provides domain-specific mobjects for system-architecture diagrams: Client, Server, Database, Arrow.
|
Package systemdesign provides domain-specific mobjects for system-architecture diagrams: Client, Server, Database, Arrow. |
