getting_started/
getting_started.rs1use motion_canvas_rs::prelude::*;
2use std::time::Duration;
3
4fn main() {
5 let mut project = Project::default()
7 .with_fps(60)
8 .with_cache(true)
9 .with_title("Getting Started")
10 .close_on_finish();
11
12 let circle = Circle::default()
14 .with_position(Vec2::new(400.0, 300.0))
15 .with_radius(50.0)
16 .with_fill(Color::rgb8(0xe1, 0x32, 0x38)); let text = TextNode::default()
19 .with_position(Vec2::new(400.0, 450.0))
20 .with_text("Hello Rust")
21 .with_font_size(40.0)
22 .with_fill(Color::rgb8(0xf2, 0xf2, 0xf2)); project.scene.add(Box::new(circle.clone()));
26 project.scene.add(Box::new(text.clone()));
27
28 project.scene.video_timeline.add(all![
30 circle.radius.to(100.0, Duration::from_secs(1)),
31 text.position
32 .to(Vec2::new(400.0, 500.0), Duration::from_secs(1)),
33 ]);
34
35 project.show().expect("Failed to render");
37}