.. _stdlib_easing: ====== 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 +++++++++ * :ref:`linear (p: float) : float ` * :ref:`inQuad (p: float) : float ` * :ref:`outQuad (p: float) : float ` * :ref:`inOutQuad (p: float) : float ` * :ref:`inCubic (p: float) : float ` * :ref:`outCubic (p: float) : float ` * :ref:`inOutCubic (p: float) : float ` * :ref:`inQuart (p: float) : float ` * :ref:`outQuart (p: float) : float ` * :ref:`inOutQuart (p: float) : float ` * :ref:`inQuintic (p: float) : float ` * :ref:`outQuintic (p: float) : float ` * :ref:`inOutQuintic (p: float) : float ` * :ref:`inSine (p: float) : float ` * :ref:`outSine (p: float) : float ` * :ref:`inOutSine (p: float) : float ` * :ref:`inCirc (p: float) : float ` * :ref:`outCirc (p: float) : float ` * :ref:`inOutCirc (p: float) : float ` * :ref:`inExp (p: float) : float ` * :ref:`outExp (p: float) : float ` * :ref:`inOutExp (p: float) : float ` * :ref:`inElastic (p: float) : float ` * :ref:`outElastic (p: float) : float ` * :ref:`inOutElastic (p: float) : float ` * :ref:`inBack (p: float) : float ` * :ref:`outBack (p: float) : float ` * :ref:`inOutBack (p: float) : float ` * :ref:`outBounce (p: float) : float ` * :ref:`inBounce (p: float) : float ` * :ref:`inOutBounce (p: float) : float ` * :ref:`inOutBezier (p: float) : float ` * :ref:`cosineFull (p: float) : float ` * :ref:`inStep (p: float) : float ` * :ref:`outStep (p: float) : float ` * :ref:`smoothStartArch3 (p: float) : float ` * :ref:`smoothStopArch3 (p: float) : float ` .. _function-easing_linear_float: .. das:function:: linear(p: float) : float Linear easing function. :Arguments: * **p** : float - Normalized time (0..1). .. _function-easing_inQuad_float: .. das:function:: inQuad(p: float) : float Quadratic easing-in function (accelerating from zero velocity). :Arguments: * **p** : float - Normalized time (0..1). .. _function-easing_outQuad_float: .. das:function:: outQuad(p: float) : float Quadratic easing-out function (decelerating to zero velocity). :Arguments: * **p** : float - Normalized time (0..1). .. _function-easing_inOutQuad_float: .. das:function:: inOutQuad(p: float) : float Quadratic easing-in/out function (acceleration until halfway, then deceleration). :Arguments: * **p** : float - Normalized time (0..1). .. _function-easing_inCubic_float: .. das:function:: inCubic(p: float) : float Cubic easing-in function (accelerating from zero velocity). :Arguments: * **p** : float - Normalized time (0..1). .. _function-easing_outCubic_float: .. das:function:: outCubic(p: float) : float Cubic easing-out function (decelerating to zero velocity). :Arguments: * **p** : float - Normalized time (0..1). .. _function-easing_inOutCubic_float: .. das:function:: inOutCubic(p: float) : float Cubic easing-in/out function (acceleration until halfway, then deceleration). :Arguments: * **p** : float - Normalized time (0..1). .. _function-easing_inQuart_float: .. das:function:: inQuart(p: float) : float Quartic easing-in function (accelerating from zero velocity). :Arguments: * **p** : float - Normalized time (0..1). .. _function-easing_outQuart_float: .. das:function:: outQuart(p: float) : float Quartic easing-out function (decelerating to zero velocity). :Arguments: * **p** : float - Normalized time (0..1). .. _function-easing_inOutQuart_float: .. das:function:: inOutQuart(p: float) : float Quartic easing-in/out function (acceleration until halfway, then deceleration). :Arguments: * **p** : float - Normalized time (0..1). .. _function-easing_inQuintic_float: .. das:function:: inQuintic(p: float) : float Quintic easing-in function (accelerating from zero velocity). :Arguments: * **p** : float - Normalized time (0..1). .. _function-easing_outQuintic_float: .. das:function:: outQuintic(p: float) : float Quintic easing-out function (decelerating to zero velocity). :Arguments: * **p** : float - Normalized time (0..1). .. _function-easing_inOutQuintic_float: .. das:function:: inOutQuintic(p: float) : float Quintic easing-in/out function (acceleration until halfway, then deceleration). :Arguments: * **p** : float - Normalized time (0..1). .. _function-easing_inSine_float: .. das:function:: 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). .. _function-easing_outSine_float: .. das:function:: 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). .. _function-easing_inOutSine_float: .. das:function:: 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). .. _function-easing_inCirc_float: .. das:function:: 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). .. _function-easing_outCirc_float: .. das:function:: 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). .. _function-easing_inOutCirc_float: .. das:function:: 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). .. _function-easing_inExp_float: .. das:function:: inExp(p: float) : float Exponential easing-in function (accelerating from zero velocity), base 2. :Arguments: * **p** : float - Normalized time (0..1). .. _function-easing_outExp_float: .. das:function:: outExp(p: float) : float Exponential easing-out function (decelerating to zero velocity), base 2. :Arguments: * **p** : float - Normalized time (0..1). .. _function-easing_inOutExp_float: .. das:function:: 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). .. _function-easing_inElastic_float: .. das:function:: inElastic(p: float) : float Elastic easing-in function (exponentially-damped sine wave, accelerating from zero velocity). :Arguments: * **p** : float - Normalized time (0..1). .. _function-easing_outElastic_float: .. das:function:: outElastic(p: float) : float Elastic easing-out function (exponentially-damped sine wave, decelerating to zero velocity). :Arguments: * **p** : float - Normalized time (0..1). .. _function-easing_inOutElastic_float: .. das:function:: 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). .. _function-easing_inBack_float: .. das:function:: inBack(p: float) : float Back easing-in function (overshooting cubic, accelerating from negative velocity). 10% overshoot. :Arguments: * **p** : float - Normalized time (0..1). .. _function-easing_outBack_float: .. das:function:: outBack(p: float) : float Back easing-out function (overshooting cubic, decelerating to negative velocity). 10% overshoot. :Arguments: * **p** : float - Normalized time (0..1). .. _function-easing_inOutBack_float: .. das:function:: 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). .. _function-easing_outBounce_float: .. das:function:: outBounce(p: float) : float Bounce easing-out function (exponentially decaying bounce to 1) :Arguments: * **p** : float - Normalized time (0..1). .. _function-easing_inBounce_float: .. das:function:: inBounce(p: float) : float Bounce easing-in function (exponentially increasing bounce from 0) :Arguments: * **p** : float - Normalized time (0..1). .. _function-easing_inOutBounce_float: .. das:function:: 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). .. _function-easing_inOutBezier_float: .. das:function:: inOutBezier(p: float) : float Smooth cubic Bezier-like easing-in/out function. :Arguments: * **p** : float - Normalized time (0..1). .. _function-easing_cosineFull_float: .. das:function:: 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). .. _function-easing_inStep_float: .. das:function:: inStep(p: float) : float Step function that jumps from 0 to 1 at p = 0.5. :Arguments: * **p** : float - Normalized time (0..1). .. _function-easing_outStep_float: .. das:function:: outStep(p: float) : float Step function that jumps from 1 to 0 at p = 0.5. :Arguments: * **p** : float - Normalized time (0..1). .. _function-easing_smoothStartArch3_float: .. das:function:: 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). .. _function-easing_smoothStopArch3_float: .. das:function:: 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).