Ease.BACK(x) → numbertweenSystem.js:335Back ease-in: overshoots backward at the start before snapping forward
xnumber
LittleJS Tween System Plugin
Ease.BACK(x) → numbertweenSystem.js:335Back ease-in: overshoots backward at the start before snapping forward
x numberEase.BEZIER(x1, y1, x2, y2) → functiontweenSystem.js:437Cubic Bezier curve solver in the style of CSS cubic-bezier.
Control points (0,0), (x1,y1), (x2,y2), (1,1).
x1 numbery1 numberx2 numbery2 numberEase.BEZIER(0.25, 0.1, 0.25, 1) // CSS "ease"Ease.BOUNCE(x) → numbertweenSystem.js:370Bouncing ease-in: small bounces near the start, then a rise to the end.
Symmetric with the other base curves, which are all ease-in. To get the
classic "object falls and hits the ground" shape (bounces near x=1),
wrap with Ease.OUT: Ease.OUT(Ease.BOUNCE).
x numberEase.BOUNCE // ease-in bounce (bouncy at start)
Ease.OUT(Ease.BOUNCE) // ease-out bounce (object hits ground)
Ease.IN_OUT(Ease.BOUNCE) // bounces at both endsEase.ELASTIC(x) → numbertweenSystem.js:341Elastic ease-in: oscillations that grow toward the end
x numberEase.IN(f) → functiontweenSystem.js:393Ease-in direction modifier: returns the curve unchanged. Symmetric
with OUT and IN_OUT. Base curves are already ease-in by
convention, so wrapping a curve in IN is a no-op — useful when
picking the direction programmatically.
f functionCurve to use as ease-in (returned unchanged)
// Pick direction at runtime
const dir = bouncyMode ? Ease.OUT : Ease.IN;
new Tween(cb, 0, 10, 1).setEase(dir(Ease.BACK));Ease.IN_OUT(f) → functiontweenSystem.js:408Combine the first half of f with Ease.OUT(f) for a symmetric curve
f functionEase.OUT(f) → functiontweenSystem.js:402Reverse a curve so it eases out instead of in: x => 1 - f(1 - x).
f functionEase.OUT(Ease.POWER(2)) // ease-out quadraticEase.PIECEWISE(…fns) → functiontweenSystem.js:416Split [0,1] into N equal sections and run a different curve in each. Each curve is mapped to its section: section i runs over [i/n, (i+1)/n] and its output is mapped to [i/n, (i+1)/n] of the overall range.
…fns functionEase.POWER(n) → functiontweenSystem.js:311Power curve factory: Ease.POWER(n) returns x => x**n.
Use n=2 for quadratic, n=3 for cubic, etc.
n numberEase.SPRING(x) → numbertweenSystem.js:351Spring ease-in: wobbles around the start before springing to the end;
Ease.OUT(Ease.SPRING) overshoots and settles on the target.
x numbertweenProperty(target, propertyPath, start, end, duration, options) → Tween<T>tweenSystem.js:497Tween a property on an object by dot-path. Returns the underlying Tween
so all chaining methods (setEase, then, loop, pingPong, etc.)
remain available.
start and end may be numbers, Vector2, Vector3 or Color instances, or
any object with a lerp(other, percent) => sameType method.
It stops on its own once the target is destroyed, so a looping tween on an object ends with it; a tween on a
value inside the object, like tweenProperty(obj.pos, 'x'), or a new Tween with its own callback, has to be
stopped by the game.
target ObjectThe object whose property is being animated
propertyPath stringDot-separated path, e.g. 'pos.x' or 'color'
start TStarting value
end TEnding value
duration number optional, default 1Duration in seconds
options Object optionalSame options as the Tween constructor
ease function optionalEasing function (defaults to LINEAR)
useRealTime boolean optional, default falseAdvance even when the game is paused
paused boolean optional, default falseStart in paused state
// Numeric: slide an object's x with an ease-out sine curve
tweenProperty(player, 'pos.x', 0, 10, 2).setEase(Ease.OUT(Ease.SINE));
// Vector2: animate a position diagonally
tweenProperty(player, 'pos', vec2(-5, 0), vec2(5, 3), 2);
// Color: pulse between two colors
tweenProperty(sprite, 'color', RED, BLUE, 1).pingPong();tweenStopAll()tweenSystem.js:675Stop every active tween, ending loops too, without calling their then-callbacks. Useful for resets on level transitions or when changing scenes.
tweenUpdate(gameDelta, realDelta)tweenSystem.js:591Engine plugin hook: advance every active tween by the appropriate delta.
The engine calls it with no arguments on every fixed update, so it can run
more than once in a rendered frame, and on paused updates too, where only
real time tweens move. May also be called with (gameDelta, realDelta) to drive tweens without the engine
loop, for headless tests or an engine in manual step that is not stepped; in a running game such a call adds to
the engine's own update, and a delta of 0 or less does nothing.
gameDelta number optionalGame-time delta in seconds; default: game time since the tween's last engine update
realDelta number optionalReal-time delta in seconds; default: real time since the tween's last engine update
Library of named easing curves and direction modifiers.
All curves accept x in [0,1] and return [0,1] (with possible overshoot
for ELASTIC/BACK/SPRING/BOUNCE). Curves are values you pass to setEase
or compose via the IN/OUT/IN_OUT/PIECEWISE/BEZIER modifiers.
// Use a basic curve
new Tween(callback, 0, 10, 1).setEase(Ease.SINE);
// Use a modifier on a curve
new Tween(callback, 0, 10, 1).setEase(Ease.OUT(Ease.BACK));