A square that turns into a circle

explainer

The brief. A square slides from left to right and turns into a circle in one second.

Open in the playground Source on GitHub

What it uses

The code

examples/src/intro.rs in oxframe-sdk, for oxframe 0.20.2. In the playground it compiles in the browser and you can change it.

//! A square slides from left to right and turns into a circle in 1 s.

use oxframe::prelude::*;

#[oxframe::scene]
pub async fn intro(view: View) {
    let square = view.add(Rect::new().size(200.0).x(-300.0).fill(color!("#e13238")));
    all((
        square.x().to(300.0, 1.0),
        square.radius().to(100.0, 1.0),
        square.fill().to(color!("#68abdf"), 1.0),
    ))
    .await;
}

pub fn project() -> Project {
    Project::new("intro").scene(intro())
}

More examples