smnandre/easing-functions

Easing & Timing Functions - Cubic-Bezier, EaseIn, Quad ...

v1.1.0 2025-02-11 12:49 UTC

This package is auto-updated.

Last update: 2025-02-11 12:53:43 UTC


README

Easing Functions

composer require smnandre/easing-functions

PHP Version CI Release License Codecov

EasingFunctions is a PHP library that provides a collection of easing functions commonly used in animations, transitions, and smooth interpolations.

It includes standard easing equations: quadratic, cubic, quartic, quintic, sine, exponential, circular, elastic, and bounce functions.

Each of them is available in three variations:

  • In: The motion starts slowly and accelerates.
  • Out: The motion starts quickly and decelerates.
  • InOut: A combination of both, accelerating at the start and decelerating at the end.

Easing Functions

Installation

composer require smnandre/easing-functions

Usage

Easing\Functions::easeOutCubic(0);
// 0
Easing\Functions::easeOutCubic(0.5);
// 0.875

$values = array_map(Easing\Functions::easeOutCubic(...), range(0, 1, 0.1));
echo implode(" ", $values);
// 0 0.271 0.488 0.657 0.784 0.875 0.936 0.973 0.992 0.999 1

Functions

Easing Functions

License

This project is licensed under the MIT License. See the LICENSE file for more information.