1use motion_canvas_rs::prelude::*;
2use std::time::Duration;
3
4fn main() {
5 let mut project = Project::default()
7 .with_fps(30)
8 .with_ffmpeg(true)
9 .with_title("Export")
10 .with_output_path("output")
11 .close_on_finish();
12
13 let circle = Circle::default()
15 .with_position(Vec2::new(400.0, 300.0))
16 .with_radius(50.0)
17 .with_fill(Color::rgb8(0x68, 0xab, 0xdf)); let text = TextNode::default()
20 .with_position(Vec2::new(400.0, 50.0))
21 .with_text("Export Demo")
22 .with_font_size(40.0)
23 .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
32 .fill_color
33 .to(Color::rgb8(0xf2, 0xf2, 0xf2), Duration::from_secs(2))
34 .ease(easings::quad_in_out),
35 circle
36 .radius
37 .to(150.0, Duration::from_secs(2))
38 .ease(easings::elastic_out),
39 text.font_size
41 .to(50.0, Duration::from_secs(2))
42 .ease(easings::cubic_out),
43 ]);
44
45 println!("Starting export to {}...", project.output_path.display());
47 project.export().expect("Failed to export");
48}