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