onion
Vector-first 2D animation checker and Lottie exporter with automated motion QA.
AI-facing 2D animation validator and exporter that checks rig or frame sequences for pops, loop seams, outliers, and arc breaks, then outputs parented Lottie JSON and onion-skin sheets.
git clone https://github.com/BestRoiMedia/anim-toolkit.gitWhy we built it
AI agents generating or assembling 2D animations cannot reliably judge frame-to-frame motion smoothness by looking at individual images. We needed a deterministic checker that returns structured JSON verdicts with exact frame numbers and pixel deltas, plus vector onion-skin and motion-trail sheets for visual inspection.
Architecture & how it works
In rig mode, onion evaluates hierarchical part transforms across keyframes with exact cubic-bezier easing equivalents (linear, in, out, inout, step) and tracks every part pivot and optional tip. In frames mode, it tracks silhouette bounding boxes, optional landmark JSON tracks, particle FX clouds, or exposure-sheet timelines (via xsheet.py). Every tracked point is tested against POP, SEAM, OUTLIER, ARC, and MISSING thresholds before exporting parented Lottie JSON, animated SVG, onion-skin sheets, motion trails, and optional resvg/python-lottie IoU verification.
Key capabilities
- Deterministic motion gates: POP, SEAM, OUTLIER, ARC, MISSING, SHORT_HOLD, FLASH, TWEEN, and LOTTIE_MISMATCH
- Rig mode preserving parented hierarchy, pivots, and exact cubic-bezier easing in exported Lottie JSON
- Frames mode supporting SVG/PNG sequences, landmark tracks, particle FX clouds, and xsheet.py exposure timing
- Playback style presets: smooth (60 fps), animation (24 fps on ones), cartoon (24 fps on twos), and clay (boil + pose jitter)
- Side-by-side style comparison rendering (<name>_compare/compare.gif + compare.json)
- Vector onion-skin sheets, motion-trail dot plots, speed spacing charts, and JSON stdout verdicts
Usage example
python3 anim/onion.py rig ./rig.json ./walk.json --style cartoon --out ./out/walk
python3 anim/onion.py frames ./frames/ --xsheet ./walk.xsheet.json --tracks ./tracks.json
python3 anim/onion.py compare rig ./rig.json ./walk.json