Preview App ellipse 示例输出
use ranim::{
    anims::{creation::WritingAnim, fading::FadingAnim, morph::MorphAnim},
    color::palettes::manim,
    core::animation::eval::StaticAnim,
    glam::dvec2,
    items::vitem::{
        VItem,
        geometry::{Circle, Ellipse},
    },
    prelude::*,
    utils::rate_functions::smooth,
};

#[scene]
#[wasm_demo_doc]
#[output(dir = "./output/ellipse")]
fn ellipse(r: &mut RanimScene) {
    // Create an ellipse (semi-axes: 3.0 x 1.5) and write it in
    let ellipse = Ellipse::new(dvec2(3.0, 1.5)).with(|e| {
        e.set_stroke_color(manim::BLUE_C);
    });
    let mut vitem = VItem::from(ellipse);

    let mut content = seq![vitem.write().with_rate_func(smooth)];

    // Transform to a circle
    let circle = Circle::new(2.0).with(|c| {
        c.set_stroke_color(manim::RED_C);
    });
    content.push(vitem.morph_to(VItem::from(circle)).with_rate_func(smooth));

    // Transform to a vertical ellipse
    let ellipse_v = Ellipse::new(dvec2(1.0, 2.5)).with(|e| {
        e.set_stroke_color(manim::GREEN_C);
    });
    content.push(
        vitem
            .morph_to(VItem::from(ellipse_v))
            .with_rate_func(smooth),
    );

    // Fade out
    content.push(vitem.fade_out().with_rate_func(smooth));

    r.play(
        CameraFrame::default()
            .show()
            .with_duration(content.cursor_sec()),
    );
    r.play(content);

    r.insert_time_mark(1.0, TimeMark::Capture("preview.png".to_string()));
}