use motion_canvas_rs::prelude::*;
use std::time::Duration;
fn main() {
let mut project = Project::new(800, 600)
.with_fps(30)
.with_ffmpeg(true)
.with_output_path("output");
let circle = Circle::default()
.with_position(Vec2::new(400.0, 300.0))
.with_radius(50.0)
.with_color(Color::rgb8(0x68, 0xab, 0xdf));
let text = TextNode::default()
.with_position(Vec2::new(200.0, 450.0))
.with_text("Export Demo")
.with_font_size(40.0)
.with_color(Color::rgb8(0xf2, 0xf2, 0xf2));
let math = MathNode::default()
.with_position(Vec2::new(400.0, 200.0))
.with_equation("E = m c^2")
.with_font_size(40.0)
.with_color(Color::rgb8(0xe6, 0xa7, 0x00));
project.scene.add(Box::new(circle.clone()));
project.scene.add(Box::new(text.clone()));
project.scene.add(Box::new(math.clone()));
project.scene.timeline.add(flows::all![
circle
.color
.to(Color::rgb8(0xf2, 0xf2, 0xf2), Duration::from_secs(2))
.ease(easings::quad_in_out),
circle
.radius
.to(150.0, Duration::from_secs(2))
.ease(easings::elastic_out),
text.font_size
.to(80.0, Duration::from_secs(2))
.ease(easings::cubic_out),
math.color
.to(Color::rgb8(0xe1, 0x32, 0x38), Duration::from_secs(2))
.ease(easings::cubic_in),
]);
println!("Starting export to {}...", project.output_path.display());
project.export().expect("Failed to export");
}