React / Canvas / Animation
Motif: writing a Lottie renderer from scratch.
Why I built a browser studio for Lottie animations on my own renderer - about 2,200 lines of dependency-free JavaScript on Canvas 2D - and what the format taught me along the way.

Lottie is the standard format for small, resolution-independent animations on the web, iOS and Android. The catch is the toolchain: you usually need After Effects to make one and a hosted service to tweak one. Motif does both in the browser, with no account and no install.
It is a keyframe editor, a page of Lottie power tools and an embeddable interactive player. Underneath all three is a renderer I wrote from the format up.
Why write a renderer at all
An editor has to show exactly what it will export, frame by frame, while you drag keyframes around. Owning the renderer meant I could make the editor and the player agree by construction, add interactions standard Lottie does not have, and keep the whole thing readable end to end. It came out at about 2,200 lines of dependency-free JavaScript drawing to Canvas 2D.
Three layers, each blind to the one above
App (React) src/pages, src/components landing, gallery, tuner, editor
Studio src/studio editor model -> Lottie JSON, tuning, export
Renderer src/lottie dependency-free Lottie playerThe renderer knows nothing about React or the editor, and the studio knows nothing about React. That rule kept most of the logic in plain JavaScript that runs under node --test, so the hard parts are tested without a browser.
What a frame actually is
A Lottie file is an After Effects composition exported to JSON. Nothing in it is video; the player rebuilds every frame from data. For each frame it finds the keyframe segment that contains the current time, eases the progress with the same cubic-bezier math as CSS, and interpolates each value. Position can follow a spatial bezier, so an arc-length table keeps the eased speed constant along the curve.
Shapes read top to bottom like the After Effects layer panel: a fill or stroke paints every path above it in the same group. The renderer walks the list bottom-up, collects those paths, and applies modifiers in order - trim paths with de Casteljau subdivision, round corners, merge paths with canvas clipping, repeaters that clone with a cumulative transform. Track mattes render on scratch canvases and combine with destination-in or destination-out.
Interactions Lottie does not have
Standard Lottie plays and loops. Motif ships a web component, <motif-player>, at about 13 KB gzipped, with hover, click, scroll, in-view and cursor-follow triggers, ping-pong playback and named segments exported as markers. You can test every trigger in a sandbox inside the editor before exporting.
AI that runs on your key
The assistant takes a plain-language request and builds the change in the editor with Claude, OpenAI, Gemini, OpenRouter or a local model. Keys stay in your browser; Motif never proxies or resells AI. Projects autosave to IndexedDB, so the studio works local-first and backups move everything between machines.
What I would tell myself on day one
Write the support matrix early. Knowing exactly what is supported - and what is not yet, like expressions, 3D layers and mask feathering - turned a vague feeling of incompleteness into a list I could work through. And keep the renderer boring: plain functions, no framework, one file per responsibility. It is the part everything else stands on.