Standardbibliothek
Antra::Easing
import Antra::EasingEasing curves for animation: Robert Penner's equations, as in raylib's reasings.h.
Easing.ease(kind, t, b, c, d) goes from b to b + c while the time
t runs from 0 to the duration d; Easing.apply(kind, x) is the same
on 0..1. A kind is :linear or a curve with _in, _out or _in_out:
sine, quad, cubic, circ, expo, back, bounce, elastic
(Easing.KINDS lists them all).
Example:
# x from 100 to 700 within 60 frames, slowing down at the end
val x = Easing.ease(:cubic_out, frame, 100, 600, 60)
Easing.apply(:quad_in, 0.5) # => 0.25Überblick#
Easing-Kurven für Animationen (Robert Penners Gleichungen, wie raylibs
reasings.h). Easing.ease(kind, t, b, c, d) läuft von b nach b + c,
während die Zeit t von 0 bis zur Dauer d geht; Easing.apply(kind, x) ist
dasselbe auf 0..1. Kurven: :linear sowie sine, quad, cubic, circ,
expo, back, bounce, elastic jeweils mit _in, _out oder _in_out
(Easing.KINDS listet alle).
import Antra::Easing
println(Easing.ease(:cubic_out, 60, 100, 600, 60)) # 700 (am Ende der 60 Frames)
println(Easing.apply(:quad_in, 0.5)) # 0.25Funktionen#
fn apply(kind, x)ease on the unit interval: the curve's value at x (0..1) going
from 0 to 1.
Example:
Easing.apply(:quad_in, 0.5) # => 0.25fn ease(kind, t, b, c, d)The value at time t (0..d) of a curve from b to b + c.
Example:
Easing.ease(:linear, 30, 0, 100, 60) # => 50
Easing.ease(:cubic_out, 60, 100, 600, 60) # => 700