eazy.
[zo@eazy] booting...
✓ loading easing curves...
✓ registered 96 profiles
✓ optimized easing functions
✓ vectorizing interpolations...
✓ compiling benchmarks...
✓ ready to smooth your pixels
✓ done in 0.0026s
eazy — THE TWEENiNG & EASiNG FUNCTiONS KiT FOR HiGH-PERFORMACE ANiMATiON.
about.
eazy iS AMONG THE FASTEST, ATOMiC AND ENHANCED easing FUNCTiONS KiT FOR CREATiVE, GAMERS, PROGRAMMERS, SCiENTiSTS, ETC WHO CARES ABOUT METRiCS — @see benchmark.
eazy iS METiCULOUSLY OPTiMiZED iT'S A PERFECT MATCH FOR PRECiSiON OR SOPHiSTiCATED PROGRAMS — SUCH AS GUi, GAME ENGiNE, PLOTS, WEB AND NATiVE APPLiCATiON. VERY USEFUL FOR iMMEDiATE MODE GUi.
OK-AY, OK-AY — BUT WHY eazy iS OUTPERFORMiNG?
- MiNiMAL OVERHEAD ABSTRACTiON — inlining, zero vtable lookups.
- MATHEMATICALLY EFFiCiENT — no branches, no inttermediate allocations.
- PROPER BENCHMARK DiSCiPLiNE — performance matter.
quick start.
use ;
easing functions.
96 EASiNG CURVES ACROSS 7 CATEGORiES, EACH WiTH In, Out, AND InOut VARiANTS.
polynomial — linear, quadratic, cubic, quartic, quintic, sextic, septic, octic, nonic, decic, hectic. trigonometric — sine, circle. exponential — expo2, expoe. logarithmic — log10. root — sqrt. oscillatory — elastic, bounce, spring. backtracking — back.
USE THEM DiRECTLY AS ZERO-COST STRUCTS OR THROUGH THE Easing ENUM:
use ;
use InQuadratic;
// Zero-cost struct (monomorphized, inlined).
let value = InQuadratic.y;
// Easing enum (dynamic dispatch).
let value = OutBounce.y;
the ease() function.
iNTERPOLATES BETWEEN TWO VALUES USiNG ANY EASiNG CURVE:
use ;
use InQuadratic;
// Static type (zero-cost, inlined).
let value = ease;
// Easing enum.
let value = ease;
// Trait object.
let curve: &dyn Curve = &InElastic;
let value = ease;
interpolation functions.
BEYOND STANDARD EASiNG — SMOOTHSTEP, RATIONAL, PiECEWiZE, AND TRiGONOMETRiC iNTERPOLATiON:
use Interpolation;
use Curve;
// Smoothstep (Hermite).
let p = InOutSmooth.y;
// Smootherstep (Ken Perlin).
let p = InOutSmoother.y;
// Quartic (Inigo Quilez).
let p = Quartic.y;
// Sinusoidal (Inigo Quilez).
let p = Sinusoidal.y;
// Rational cubic.
let p = InRationalCubic.y;
tweens.
GSAP-LiKE ANiMATiON RUNTiME. TWEEN BETWEEN ANY TWO VALUES WiTH FiNE-GRAiNED CONTROL:
use ;
let mut tween = to
.duration
.easing
.delay
.on_complete
.build;
tween.play;
// In your update loop (~60 FPS):
while tween.tick
repeat & yoyo.
use ;
// Repeat 3 times with yoyo (ping-pong).
let mut tween = to
.duration
.easing
.repeat
.yoyo
.build;
tween.play;
// Infinite repeat.
let mut tween = to
.duration
.repeat
.build;
time scale.
use ;
let mut tween = to
.duration
.time_scale // 2x speed.
.build;
tween arrays & tuples.
use ;
// Tween a 3D position.
let mut tween = new;
tween.play;
tween.tick;
let pos = tween.value; // [50.0, 100.0, 150.0]
timelines.
SEQUENCE MULTiPLE TWEENS WiTH PRECiSE TiMiNG — SEQUENTIAL, PARALLEL, OR OVERLAPPiNG:
use ;
let mut timeline = builder
// First tween: 0.0s -> 1.0s.
.push
// Parallel with previous (starts at same time).
.push_at
// Overlap by 0.2s (starts before previous ends).
.push_at
.build;
timeline.play;
// Tick in your update loop.
while timeline.tick
labels.
use ;
let timeline = builder
.push
.label
.push
.build;
// Jump to label.
let time = timeline.get_label; // Some(1.0)
GSAP-style position strings.
use Position;
let pos = from; // WithPrevious
let pos = from; // AfterPrevious
let pos = from; // Relative(0.5)
let pos = from; // Relative(-0.3) — overlap
staggers.
CASCADiNG ANiMATiONS — DOMiNO FALLS, WAVE EFFECTS, RiPPLES:
use ;
let tweens: =
.map
.collect;
// 0.1s between each, starting from center outward.
let mut timeline = builder
.push_staggered
.build;
timeline.play;
stagger directions.
use ;
// First to last (default).
each.from;
// Last to first.
each.from;
// Center outward.
each.from;
// Edges inward.
each.from;
// Distribute across a total duration.
total; // 10 items = 0.1s between each.
// Eased distribution.
each.ease;
keyframes.
DEFiNE COMPLEX ANiMATiONS WiTH VALUES AT SPECiFiC TiME POiNTS:
use ;
let track = new
.keyframe
.keyframe_eased
.keyframe;
let value = track.sample; // Interpolated between keyframes.
let value = track.sample; // OutBounce easing applied.
keyframes! macro.
use ;
// Concise syntax.
let track = keyframes!;
// Works with arrays too (positions, colors).
let track = keyframes!;
let pos = track.sample;
derive tweenable.
MAKE ANY STRUCT ANiMATABLE WiTH #[derive(Tweenable)]:
use Tweenable;
let red = Color ;
let blue = Color ;
let purple = red.lerp;
// Color { r: 0.5, g: 0.0, b: 0.5, a: 1.0 }
// Works with tuple structs too.
;
let mid = Vec2.lerp;
// Vec2(50.0, 100.0)
egui integration.
BOUNCiNG BALL WiTH eazy + egui:
use ;
use egui;
use Instant;
STAGGERED TiMELiNE WiTH egui:
use ;
use Instant;
// Create 5 balls with staggered bounce from center outward.
let tweens =
.map
.;
let mut timeline = builder
.push_staggered
.build;
timeline.play;
// In your update loop:
let delta = last_frame.elapsed.as_secs_f32;
timeline.tick;
let progress = timeline.progress;
callbacks.
SYNC AND ASYNC LiFECYCLE CALLBACKS:
use ;
let mut tween = to
.duration
.easing
.on_start
.on_update
.on_complete
.on_repeat
.build;
SiMD.
BATCH PROCESS 8 VALUES AT ONCE WiTH CurveSIMD AND wide::f32x8:
use CurveSIMD;
use f32x8;
// All easing functions have SIMD variants
// for processing 8 values simultaneously.
features.
ENABLiNG DERiVE MACRO:
[]
= { = "0.0.1", = ["derive"] }
examples.
MORE EXAMPLES here.
- supports for egui, bevy.
benches.
beat'em up!
BENCHES ARE DONE iN COMPARiSON BETWEEN easings, emathegui , glissade, interpolationpisthon, keyframe, nova-easing, simple-easing2 CRATES. MOST OF THEM ARE FOLLOW THE ROBERT PENNER'S EASiNG FUNCTiONS, THEY ONLY iMPLEMENTED THE BASiCS ONE. REGARDiNG PERFORMANCE SOME OF OUR iMPLEMENTATiONS ARE SLiGHTLY FASTER AND STABLE, SO DEPENDiNG YOUR NEEDED, YOU SHOULD TRY eazy. THE SAMPLE BELOW CONFiRM THAT OUR EASiNG FUNCTiONS ARE PRETTY WELL OPTiMiZED.
@see @benchmark-reports.
contributing.
WE LOVE CONTRiBUTORS.
FEEL FREE TO OPEN AN iSSUE iF YOU WANT TO CONTRiBUTE OR COME TO SAY HELLO ON discord. ALSO YOU CAN CONTACT US AT THE [at] COMPiLORDS [dot] HOUSE. THiS iS A PLAYGROUND FOR COMPiLER NERDS, FRONTEND HACKERS, AND CREATIVE.
license.
COPYRiGHT© 10 JULY 2024 — PRESENT, @invisageable.