Easing
This module contains various easing functions that can be used for animations and transitions. Each function takes a normalized time parameter p (ranging from 0 to 1) and returns a value representing the eased progress of an animation, allowing for different acceleration and deceleration effects during the animation process. These functions can be used in conjunction with the tween module for smooth animations.
To use this component, add the following line to your project file:
require engine.tweener.easing // or require engine.core
Functions
- linear(p: float): float
Linear easing function.
- Arguments:
p : float - Normalized time (0..1).
- inQuad(p: float): float
Quadratic easing-in function (accelerating from zero velocity).
- Arguments:
p : float - Normalized time (0..1).
- outQuad(p: float): float
Quadratic easing-out function (decelerating to zero velocity).
- Arguments:
p : float - Normalized time (0..1).
- inOutQuad(p: float): float
Quadratic easing-in/out function (acceleration until halfway, then deceleration).
- Arguments:
p : float - Normalized time (0..1).
- inCubic(p: float): float
Cubic easing-in function (accelerating from zero velocity).
- Arguments:
p : float - Normalized time (0..1).
- outCubic(p: float): float
Cubic easing-out function (decelerating to zero velocity).
- Arguments:
p : float - Normalized time (0..1).
- inOutCubic(p: float): float
Cubic easing-in/out function (acceleration until halfway, then deceleration).
- Arguments:
p : float - Normalized time (0..1).
- inQuart(p: float): float
Quartic easing-in function (accelerating from zero velocity).
- Arguments:
p : float - Normalized time (0..1).
- outQuart(p: float): float
Quartic easing-out function (decelerating to zero velocity).
- Arguments:
p : float - Normalized time (0..1).
- inOutQuart(p: float): float
Quartic easing-in/out function (acceleration until halfway, then deceleration).
- Arguments:
p : float - Normalized time (0..1).
- inQuintic(p: float): float
Quintic easing-in function (accelerating from zero velocity).
- Arguments:
p : float - Normalized time (0..1).
- outQuintic(p: float): float
Quintic easing-out function (decelerating to zero velocity).
- Arguments:
p : float - Normalized time (0..1).
- inOutQuintic(p: float): float
Quintic easing-in/out function (acceleration until halfway, then deceleration).
- Arguments:
p : float - Normalized time (0..1).
- inSine(p: float): float
Sine easing-in function (accelerating from zero velocity). Modeled after quarter-cycle of sine wave.
- Arguments:
p : float - Normalized time (0..1).
- outSine(p: float): float
Sine easing-out function (decelerating to zero velocity). Modeled after quarter-cycle of sine wave.
- Arguments:
p : float - Normalized time (0..1).
- inOutSine(p: float): float
Sine easing-in/out function (acceleration until halfway, then deceleration). Modeled after half sine wave.
- Arguments:
p : float - Normalized time (0..1).
- inCirc(p: float): float
Circular easing-in function (accelerating from zero velocity). Modeled after quadrant of unit circle.
- Arguments:
p : float - Normalized time (0..1).
- outCirc(p: float): float
Circular easing-out function (decelerating to zero velocity). Modeled after quadrant of unit circle.
- Arguments:
p : float - Normalized time (0..1).
- inOutCirc(p: float): float
Circular easing-in/out function (acceleration until halfway, then deceleration). Modeled after piecewise circular function with two quadrants of unit circle, connected at 0.5.
- Arguments:
p : float - Normalized time (0..1).
- inExp(p: float): float
Exponential easing-in function (accelerating from zero velocity), base 2.
- Arguments:
p : float - Normalized time (0..1).
- outExp(p: float): float
Exponential easing-out function (decelerating to zero velocity), base 2.
- Arguments:
p : float - Normalized time (0..1).
- inOutExp(p: float): float
Exponential easing-in/out function (acceleration until halfway, then deceleration), base 2. Modeled after piecewise exponential function with two halves, connected at 0.5.
- Arguments:
p : float - Normalized time (0..1).
- inElastic(p: float): float
Elastic easing-in function (exponentially-damped sine wave, accelerating from zero velocity).
- Arguments:
p : float - Normalized time (0..1).
- outElastic(p: float): float
Elastic easing-out function (exponentially-damped sine wave, decelerating to zero velocity).
- Arguments:
p : float - Normalized time (0..1).
- inOutElastic(p: float): float
Elastic easing-in/out function (exponentially-damped sine wave, acceleration until halfway, then deceleration). Modeled after piecewise exponentially-damped in and out sine waves, connected at 0.5.
- Arguments:
p : float - Normalized time (0..1).
- inBack(p: float): float
Back easing-in function (overshooting cubic, accelerating from negative velocity). 10% overshoot.
- Arguments:
p : float - Normalized time (0..1).
- outBack(p: float): float
Back easing-out function (overshooting cubic, decelerating to negative velocity). 10% overshoot.
- Arguments:
p : float - Normalized time (0..1).
- inOutBack(p: float): float
Back easing-in/out function (overshooting cubic, acceleration until halfway, then deceleration). 10% overshoot.
- Arguments:
p : float - Normalized time (0..1).
- outBounce(p: float): float
Bounce easing-out function (exponentially decaying bounce to 1)
- Arguments:
p : float - Normalized time (0..1).
- inBounce(p: float): float
Bounce easing-in function (exponentially increasing bounce from 0)
- Arguments:
p : float - Normalized time (0..1).
- inOutBounce(p: float): float
Bounce easing-in/out function (exponentially increasing bounce from 0 until halfway, then exponentially decaying bounce to 1). Modeled after piecewise in and out bounce connected at 0.5.
- Arguments:
p : float - Normalized time (0..1).
- inOutBezier(p: float): float
Smooth cubic Bezier-like easing-in/out function.
- Arguments:
p : float - Normalized time (0..1).
- cosineFull(p: float): float
Full-period cosine-based easing function. Note that it ends at 0., not 1.
- Arguments:
p : float - Normalized time (0..1).
- inStep(p: float): float
Step function that jumps from 0 to 1 at p = 0.5.
- Arguments:
p : float - Normalized time (0..1).
- outStep(p: float): float
Step function that jumps from 1 to 0 at p = 0.5.
- Arguments:
p : float - Normalized time (0..1).
- smoothStartArch3(p: float): float
Smooth start arch function (cubic arch, slow increase to 1 and then fast decrease to 0). Note that it ends at 0., not 1.
- Arguments:
p : float - Normalized time (0..1).
- smoothStopArch3(p: float): float
Smooth stop arch function (cubic arch, fast increase to 1 and then slow decrease to 0). Note that it ends at 0., not 1.
- Arguments:
p : float - Normalized time (0..1).