Mina

A simple, expressive, framework-independent animation library for Rust.

Features

Goals

Timeline Example

Note: This is example, and all other examples on this page, include only the code used to create the timelines and/or animators. The full examples will always be available in the examples directory.

Moving Shape

```rust

[derive(Animate)]

struct Shape { size: f32, #[animate] x: f32, #[animate] y: f32, }

impl Shape { pub fn new(size: f32) -> Self { Shape { size, x: 0.0, y: 0.0 } } }

let timeline = timeline!(Shape 5s infinite Easing::OutCubic from { x: -150.0, y: 60.0 } 25% { x: 150.0, y: 60.0 } 50% { x: 150.0, y: -60.0 } 75% { x: -150.0, y: -60.0 } to { x: -150.0, y: 60.0 }); ```

See the full example (uses nannou).

Animator Example

Fancy Widgets

```rust

[derive(Animate, Clone, Debug, Default)]

struct Effects { backgroundalpha: f32, emissionalpha: f32, emission_scale: f32, }

const EFFECT_SCALE: f32 = 2.0;

let animator = animator!(Effects { default(Interaction::None, { backgroundalpha: 0.5, emissionalpha: 0.25, emissionscale: 0.85 }), Interaction::None => [ 0.5s Easing::OutCubic to { backgroundalpha: 0.5 }, 2s Easing::OutQuint infinite from { emissionalpha: 0.0, emissionscale: 0.0 } 2% { emissionalpha: 0.15, emissionscale: 0.0 } 5% { emissionscale: 0.85 } Easing::InOutCirc 75% { emissionalpha: 0.0 } 100% { emissionscale: EFFECTSCALE }, ], Interaction::Over => 0.5s Easing::OutCubic to { backgroundalpha: 0.8, emissionalpha: 0.0, emissionscale: 0.85, }, Interaction::Down => [ 0.5s Easing::OutCubic to { backgroundalpha: 1.0, emissionalpha: 0.0, emissionscale: 0.85, }, 3s Easing::OutExpo 1% { emissionscale: 1.05 } to { emissionalpha: 0.1, emission_scale: 1.5 } ] }); ```

The above is taken from the widget example using iced.

Roadmap

More Examples

Progress Indicator

Progress Indicator

Bevy Shapes and Sprites

Progress Indicator

Canvas Example (code coming soon!)

Canvas Example