nice_and_easy

Crates.ionice_and_easy
lib.rsnice_and_easy
version2.0.8
sourcesrc
created_at2024-09-04 21:45:40.958221
updated_at2024-09-05 10:47:43.526206
descriptionA minimalistic Rust library for smooth and effortless easing functions
homepagehttps://github.com/petergilmour1987/nice_and_easy
repositoryhttps://github.com/petergilmour1987/nice_and_easy
max_upload_size
id1363859
size27,862
Peter Gilmour (petergilmour1987)

documentation

https://docs.rs/nice_and_easy

README

nice_and_easy is a Rust library designed to make smooth transitions a breeze.

Whether you’re working with f32 or f64 types, this library offers a wide range of easing functions that help you create fluid animations and transitions in your applications.

From linear to more complex easing functions, nice_and_easy has you covered, allowing you to focus on crafting delightful user experiences without the hassle.

Features:

  • Comprehensive collection of easing functions.
  • Seamless support for both f32 and f64 types
  • Lightweight and easy to integrate into any Rust project.
  • Perfect for game development, UI animations, and more.

With nice_and_easy, achieving smooth, natural motion has never been easier!

For visualizing these functions, you can use the website https://easings.net

  • t is the progress of the tween, ranging from 0 to d.
  • b is the starting value of the property.
  • c is the change between the starting and ending value of the property.
  • d is the total duration
use nice_and_easy::*;

fn main() {
    // Can be used with f32...
    let progress: f32 = 0.5;
    let starting_value: f32 = 0.0;
    let target: f32 = 2.0;
    let duration: f32 = 1.0;
    let value: f32 = sine_in_out(progress, starting_value, target, duration);
    assert_eq!(value, 1.0);

    // ...or f64
    let progress: f64 = 0.5;
    let starting_value: f64 = 0.0;
    let target: f64 = 2.0;
    let duration: f64 = 1.0;
    let value: f64 = quad_in_out(progress, starting_value, target, duration);
    assert_eq!(value, 1.0);
}

Commit count: 0

cargo fmt