#easing #net #functions #linear #effect #might #bounce

simple-easing

Set of simple easing functions

2 stable releases

1.0.1 Jan 12, 2023
1.0.0 Aug 20, 2021

#1106 in Algorithms

Download history 919/week @ 2023-11-20 1092/week @ 2023-11-27 997/week @ 2023-12-04 675/week @ 2023-12-11 771/week @ 2023-12-18 279/week @ 2023-12-25 600/week @ 2024-01-01 801/week @ 2024-01-08 1018/week @ 2024-01-15 899/week @ 2024-01-22 886/week @ 2024-01-29 754/week @ 2024-02-05 980/week @ 2024-02-12 797/week @ 2024-02-19 572/week @ 2024-02-26 450/week @ 2024-03-04

2,838 downloads per month
Used in 7 crates (3 directly)

MIT/Apache

8KB
204 lines

simple-easing

This package contains a set of simple easing functions.


lib.rs:

This package contains a set of simple easing functions. That consume a standardised time attribute in the range between 0.0 and 1.0, that represent the progress of a transition. 0.0 being the beginning, 1.0 the end.

They return a value between 0.0 and 1.0 (it might exceed the 0..=1 range temporarily for a bounce effect). The returned value can be used to interpolate between the initial (0.0) and the final (1.0) transition state, allowing for a "more natural" feel of a transition by accelerating and decelerating at certain points, depending on the easing function used.

Visit easings.net to see visualisations of the different easing functions.

All easing functions have the same signature ((f32) -> f32) and can be easily stored as fn pointers.

use ::simple_easing::linear;
let easing: fn(f32) -> f32 = linear;
assert_eq!(easing(1.0), 1.0);

No runtime deps