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(&circle);
26 project.scene.add(&text);
27
28 project.scene.video_timeline.add(all![
30 circle
32 .fill_paint
33 .to(
34 Paint::Solid(Color::rgb8(0xf2, 0xf2, 0xf2)),
35 Duration::from_secs(2)
36 )
37 .ease(easings::quad_in_out),
38 circle
39 .radius
40 .to(150.0, Duration::from_secs(2))
41 .ease(easings::elastic_out),
42 text.font_size
44 .to(50.0, Duration::from_secs(2))
45 .ease(easings::cubic_out),
46 ]);
47
48 println!("Starting export to {}...", project.output_path.display());
50 project.export().expect("Failed to export");
51}