Motion Canvas in Rust
A high-performance vector animation engine inspired by Motion Canvas, built on Vello and Typst.
[!IMPORTANT] Prototype Status: This project is a functional prototype and proof-of-concept. It is not a 1:1 implementation of the original Motion Canvas API or features.
Installation
Add the library to your Cargo.toml. To enable all features (math, code blocks, images, export), use the full flag:
# Enable everything
# Or pick only what you need (e.g., just math and images)
Features
| Feature | Description | Enables |
|---|---|---|
math |
Typst-powered LaTeX math rendering. | MathNode |
code |
Syntax-highlighted code blocks via Syntect. | CodeNode |
image |
Bitmap image support (PNG, JPEG, etc.). | ImageNode |
svg |
Vector graphics support using resvg. |
SvgNode |
export |
Headless frame rendering and video generation. | project.export() |
full |
Meta-feature that enables all of the above. | Everything |
Key Capabilities
- High-performance: GPU-accelerated vector rendering via Vello.
- Arc-length Sampling: Accurate path animations and offsets.
- Easing Library: 30+ standardized easing functions.
- FFmpeg Integration: Direct streaming of animation frames to video.
- Clean API: Streamlined prelude for high-speed prototyping.
Project Structure
The engine is organized into a modular structure:
src/lib.rs: Library entry point with clean module re-exports.src/engine/nodes/: Individual node implementations.src/engine/animation/: Core animation traits and flow controls.src/engine/easings.rs: Comprehensive easing function library.examples/: Ready-to-run demonstration scripts.
Quick Start
use *;
use Duration;
Running Examples
The project includes several formal examples covering different features. You can run them using cargo run --example <name>.
https://github.com/user-attachments/assets/7590c3da-8917-4ac4-8832-425211fab67b
https://github.com/user-attachments/assets/97050ee4-0a67-4c4c-ba5d-737d7d0c101d
https://github.com/user-attachments/assets/25248e66-ccc7-4422-9f2f-7b9ef361d8d9
https://github.com/user-attachments/assets/d283b03a-ae50-4011-9fab-77ced70a2632
https://github.com/user-attachments/assets/097e5b01-cdf4-4c9d-90a5-4cc4fc12e3ea
https://github.com/user-attachments/assets/f3d8e774-31f4-4e96-b7b7-9e6bda0ec16f
https://github.com/user-attachments/assets/cd002797-84ec-4bcb-af1f-0ab6e7c20433
https://github.com/user-attachments/assets/c01897a9-e744-43af-bfee-045f44549ba9
Requirements
- Rust 1.75+
- FFmpeg (optional, for direct video streaming)
- System fonts (Inter, Fira Code, etc. for specific examples)
Credits
This project is heavily inspired by the original Motion Canvas by aarthificial. It aims to be a proof of concept of the same declarative animation feel in Rust.