Skip to main content

Crate ranim

Crate ranim 

Source
Expand description

Ranim is an animation engine written in rust based on wgpu, inspired by 3b1b/manim and jkjkil4/JAnim.

A project binary registers its scenes and hands control to the command line interface:

ⓘ
use ranim::prelude::*;

#[scene]
fn hello(r: &mut RanimScene) { /* ... */ }

fn main() {
    // cargo run -- preview | output | render hello | inspect scenes
    let mut app = App::new();
    app.add_scenes([hello::scene()]);
    run_cli(app.build());
}

Plugins organize larger projects and custom render configurations:

use ranim::{App, Plugin, Resource};

/// Project resources must implement bevy's `Resource`.
#[derive(Resource)]
struct ProjectConfig(u32);

struct ProjectPlugin;

impl Plugin for ProjectPlugin {
    fn build(&self, app: &mut bevy_app::App) {
        app.insert_resource(ProjectConfig(42));
    }
}

let mut app = App::new();
app.add_plugins(ProjectPlugin);
assert_eq!(app.world().resource::<ProjectConfig>().0, 42);

§Coordinate System

Ranim’s coordinate system is right-handed coordinate:

     +Y
     |
     |
     +----- +X
   /
+Z

Re-exports§

pub use app::AppExt;
pub use app::Output;
pub use app::OutputFormat;
pub use app::RanimApp;
pub use app::RanimAppExt;
pub use app::Scene;
pub use app::SceneConfig;
pub use app::SceneConstructor;
pub use app::Scenes;
pub use ranim_anims as anims;anims
pub use ranim_core as core;
pub use ranim_items as items;items
pub use ranim_render as render;render
pub use core::glam;

Modules§

app
The project application: scenes, plugins, and resources Project configuration and scene registration for Ranim.
cmd
Commands like preview and render
color
Color utilities.
prelude
The preludes
utils
Utils

Macros§

lagged
Construct an AnimLagged with a stagger ratio, pushing each animation in order.
seq
Construct an AnimSequence by playing each animation in order.
stack
Construct an AnimStack by pushing each animation at the same origin.

Structs§

App
App is the primary API for writing user applications. It automates the setup of a standard lifecycle and provides interface glue for plugins.
RanimScene
Animation definition builder passed to scene constructors.

Traits§

Plugin
A collection of Bevy app logic and configuration.
Resource
A type that can be inserted into a World as a singleton.

Derive Macros§

Resource
Implement the Resource trait.