Function easing

Applies an easing function to a given progress value.

This function calculates eased progress using a specified easing function, bezier curve, or custom easing function.

The current progress value, typically between 0 and 1.

The easing method to apply. It can be:

  • A predefined easing function (e.g., EaseInBounce).
  • A bezier array (e.g., [0.25, 0.1, 0.25, 1]).
  • A custom easing function (e.g., (value) => Math.sin(Math.PI * 0.5 * value)).
  • The eased progress value.
easing(0.35, EaseInBounce);
// => 0.167 (eased progress using EaseInBounce)

easing(0.35, [0.25, 0.1, 0.25, 1]);
// => 0.604 (eased progress using a bezier curve)

easing(0.35, (value) => Math.sin(Math.PI * 0.5 * value));
// => 0.522 (eased progress using a custom easing function)