1 Star 0 Fork 0

joylei / anim-rs

Create your Gitee Account
Explore and code with more than 8 million developers,Free private repositories !:)
Sign up
Clone or Download
Cancel
Notice: Creating folder will generate an empty file .keep, because not support in Git
Loading...
README.md

EN | 中文

anim

Test and Build Documentation Crates.io License

A framework independent animation library for rust, works nicely with Iced and the others.

Showcase

Color&Opacity Animation Example

Size Animation Example

Raindrop Splash Animation

How to install?

Include anim in your Cargo.toml dependencies:

[dependencies]
anim = "0.1"

Note: anim turns on iced-backend feature by default. You need to disable default features if you do not work with iced.

[dependencies]
anim = { version="0.1", default-features = false }

How to use?

There are 3 important concepts in anim:

  • Animatable Types derived from Animatable means that its values can be calculated based on timing progress, with which you can create Animation objects.

  • Animation The Animation generates values based on its timing progress. You can construct a big Animation from small ones.

  • Timeline With Timeline you can control your animations' lifetime.


For simple scenarios, you just need Options.

use anim::{Options, Timeline, Animation, easing};

Then, build and start your animation:

use std::time::Duration;
use anim::{Options, Timeline, Animation, easing};

let mut timeline = Options::new(20,100).easing(easing::bounce_ease())
    .duration(Duration::from_millis(300))
    .begin_animation();

loop {
    let status = timeline.update();
    if status.is_completed() {
       break;
    }
    println!("animated value: {}", timeline.value());
}

For complex scenarios, please look at examples to gain some ideas.

How to run the examples?

Example #1: color-example

This example shows you color animations:

cargo run --release --example color-example

Example #2: size-example

This example shows you size animations:

cargo run --release --example size-example

Example #3: animated-splash

This example shows you rain dop splash animations:

cargo run --release --example animated-splash

License

MIT

Repository Comments ( 0 )

Sign in to post a comment

About

纯Rust语言编写的动画库,可以配合Iced和其它GUI框架工作。 expand collapse
Cancel

Releases

No release

Contributors

All

Activities

Load More
can not load any more
Rust
1
https://git.oschina.net/wowin/anim-rs.git
git@git.oschina.net:wowin/anim-rs.git
wowin
anim-rs
anim-rs
master

Search

挂件 关闭按钮