Crate nice_and_easy

Source
Expand description

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);
}

Functions§

back_in
back_in easing
back_in_out
back_in_out easing
back_out
back_out easing
bounce_in
bounce_in easing
bounce_in_out
bounce_in_out easing
bounce_out
bounce_out easing
circ_in
circ_in easing
circ_in_out
circ_in_out easing
circ_out
circ_out easing
cubic_in
cubic_in easing
cubic_in_out
cubic_in_out easing
cubic_out
cubic_out easing
elastic_in
elastic_in easing
elastic_in_out
elastic_in_out easing
elastic_out
elastic_out easing
expo_in
expo_in easing
expo_in_out
expo_in_out easing
expo_out
expo_out easing
linear
linear easing
quad_in
quad_in easing
quad_in_out
quad_in_out easing
quad_out
quad_out easing
quart_in
quart_in easing
quart_in_out
quart_in_out easing
quart_out
quart_out easing
quint_in
quint_in easing
quint_in_out
quint_in_out easing
quint_out
quint_out easing
sine_in
sine_in easing
sine_in_out
sine_in_out easing
sine_out
sine_out easing