百科.dev
全部条目在线工具AI 编程趋势榜开源项目技术资讯提交条目
登录
< 返回工具列表
M

motiongfx

> 编程语言
开源

后端无关的动画图形创建框架。

364 stars0 点赞1 次浏览
访问官网GitHub

工具介绍

后端无关的动画图形创建框架。

MotionGfx

MotionGfx is a backend-agnostic motion graphics framework. It provides a modular foundation for procedural animations.

Key Features

  • Backend agnostic: Works with any rendering backend.
  • Procedural: Write animations with code - loops, functions, logic.
  • Type-erased: Powered by Field Path & Typarena, allowing runtime-flexible animation of arbitrary data.
  • Two-way playback: Play animations both forward and backward with no extra computation.
  • Batteries included: Packed with common easing and interpolation functions.

Quick Start

…

The Registry

The Registry keeps track of how to animate your types behind the scenes. motiongfx is type-erased at runtime, so it needs the registry to know how to read and write each field. You don't need to set it up manually, just create one and pass it to the builder. Registration happens automatically the first time you add an animation.

rust
# use motiongfx::prelude::*;
let mut registry = Registry::new();

The Timeline Builder

The TimelineBuilder is where you describe your animations. Create one from the registry, typed to your data holder:

rust
# use motiongfx::prelude::*;
# let mut registry = Registry::new();
# type World = Vec;
let mut b = registry.create_builder::();

Building the Timeline

Animations are built up in layers:

  1. An action says what to animate and how to transform it.
  2. A track fragment gives the action a duration by calling .play(duration).
  3. A track is one or more fragments compiled together. You can order fragments before compiling (see Track Ordering).
  4. A timeline combines all your tracks into one playable sequence.
…

Bake and Sample

Before playing an animation, you need to bake it. Baking reads the starting values from your world and prepares the animation data. This only needs to happen once, right after building the timeline.

To advance the animation, set a target time, then queue and sample. Queuing figures out which actions are active at that time, and sampling writes the new values back into your world.

A timeline can also have multiple tracks, each acting as a chapter. Use set_target_track to jump between them.

rust
# #[path = "docs/world.rs"] mod _doc; use _doc::*;
# let mut subjects = World(vec![0.0]);
# let (registry, mut timeline) = timeline();
// Bake once after building the timeline.
timeline.bake_actions(&registry, &subjects);

// Set target time, queue, then sample.
timeline.set_target_time(cs(50));
timeline.queue_actions();
timeline.sample_queued_actions(&registry, &mut subjects);

assert!((subjects.0[0] - 5.0).abs() < f32::EPSILON);

Track Ordering

You can control how fragments play relative to each other. There are 4 ordering combinators:

1. Chain

rust
use motiongfx::prelude::*;

// Using empty fragments as an example only.
let f0 = TrackFragment::new();
let f1 = TrackFragment::new();

let f = [f0, f1].ord_chain();
// Or...
// use motiongfx::track::chain;
// let f = chain([f0, f1]);

f1 plays after f0 finishes.

2. All

rust
use motiongfx::prelude::*;

let f0 = TrackFragment::new();
let f1 = TrackFragment::new();

let f = [f0, f1].ord_all();

f0 and f1 play at the same time, and the result finishes when both are done.

3. Any

rust
use motiongfx::prelude::*;

let f0 = TrackFragment::new();
let f1 = TrackFragment::new();

let f = [f0, f1].ord_any();

f0 and f1 play at the same time, and the result finishes when either one is done.

4. Flow

rust
use motiongfx::prelude::*;

let f0 = TrackFragment::new();
let f1 = TrackFragment::new();

let f = [f0, f1].ord_flow(cs(50));

f1 starts 0.5 seconds after f0 begins, regardless of how long f0 takes.

Officially Supported Backends

  • Bevy MotionGfx

Join the community!

You can join us on the Voxell discord server.

Inspirations and Similar Projects

  • Motion Canvas
  • Manim

License

motiongfx is dual-licensed under either:

  • MIT License (LICENSE-MIT or http://opensource.org/licenses/MIT)
  • Apache License, Version 2.0 (LICENSE-APACHE or http://www.apache.org/licenses/LICENSE-2.0)

This means you can select the license you prefer! This dual-licensing approach is the de-facto standard in the Rust ecosystem and there are very good reasons to include both.

Issues· 0 开放

查看全部 Issues在 GitHub 打开

暂无开放 Issues,或尚未同步最近议题。

> 标签

Rustanimationframeworkmotion-graphicsprocedural

暂无评论,来聊聊你的看法吧

> 工具信息

发布日期2026年8月1日
最后更新2026年9月17日
分类编程语言
定价开源

> 相关工具

T
TypeScript
JavaScript 的超集,为前端与全栈提供静态类型
P
Python
通用编程语言,广泛用于 Web、数据与 AI
G
Go
Google 推出的简洁高效系统语言