easings_gleam
Easing functions for animation in pure Gleam.
gleam add easings_gleam
import ease
pub fn main() {
// Compute the easing for bounce-in halfway-through the transition
0.5 |> ease.bounce()
// -> 0.234375
}
Bounce-In:
1 _ ________________________________________________⣀⣀⡀
_ ⢀⠤⠒⠊⠉
0.75 _ ⡠⠊⠁
_ ⡠⠊
0.5 _ ⡠⠊
_ ⢀⠔
0.25 _ ⢀⣀⣀⣀⣀⡀ ⠠⠂
_ ⣀⠤⠒⠉⠁ ⠈⠉⠒⠤⣀ ⡐⠁
0 _ ⣀⣀⣀⣀⣀⡠⠤⠒⠒⠒⠒⠢⠤⢄⠤⠊______________⠑⢄⠔__________________
|''''|''''|''''|''''|''''|''''|''''|''''|''''|''''|
0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1
Elastic-Out:
⢀⡀
⡐⠁⠈⠢
⠠ ⠑⡀
1 _ ____⠂_____⠐⠄______⢀⡠⠤⠤⠤⠤⠤⢄⣀⣀⣀_⣀⣀⣀⣀⣀⣀⣀⣀⣀⣀⣀⣀⣀⣀⣀⣀⣀⣀⣀⣀⡀
_ ⠐ ⠈⠢⣀⣀⣀⠤⠊⠁ ⠉
0.75 _ ⠄
_ ⠠
0.5 _ ⡀
_
0.25 _ ⠈
_ ⠁
0 _ ⡈__________________________________________________
|''''|''''|''''|''''|''''|''''|''''|''''|''''|''''|
0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1
Quartic-In-Out:
1 _ _______________________________________⢀⣀⣀⣀⣀⣀⣀⣀⣀⣀⣀⡀
_ ⣀⠤⠔⠒⠊⠉⠉⠁
0.75 _ ⡠⠔⠉
_ ⢀⠔⠊
0.5 _ ⡠⠂
_ ⢀⠊
0.25 _ ⡠⠒⠁
_ ⢀⡠⠔⠉
0 _ ⣀⣀⣀⣀⣀⣀⣀⣀⣀⣀⣀⠤⠤⠤⠒⠒⠉⠁_________________________________
|''''|''''|''''|''''|''''|''''|''''|''''|''''|''''|
0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1
Further documentation can be found at https://hexdocs.pm/easings_gleam.
Development
gleam test # Run the tests
gleam run -m birdie # Update test snapshots