{"id":24637923,"url":"https://github.com/smnandre/easing-functions","last_synced_at":"2025-03-20T09:25:42.462Z","repository":{"id":273221289,"uuid":"818755700","full_name":"smnandre/easing-functions","owner":"smnandre","description":"Timing \u0026 easing functions PHP nano library - EaseIn, EaseOut, CubicBezier ...","archived":false,"fork":false,"pushed_at":"2025-03-10T18:54:55.000Z","size":90,"stargazers_count":3,"open_issues_count":0,"forks_count":3,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-03-10T19:43:36.868Z","etag":null,"topics":["animation","cubic-bezier","easeinout","easing","easing-functions","function","no-deps","php","php-library","svg","timing","transition"],"latest_commit_sha":null,"homepage":"","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/smnandre.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null},"funding":{"github":["smnandre"]}},"created_at":"2024-06-22T19:12:13.000Z","updated_at":"2025-03-10T18:54:59.000Z","dependencies_parsed_at":"2025-03-10T19:36:11.228Z","dependency_job_id":"c40a29b8-7c35-4bf0-ba0e-44bda9361d46","html_url":"https://github.com/smnandre/easing-functions","commit_stats":null,"previous_names":["smnandre/easing-functions"],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/smnandre%2Feasing-functions","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/smnandre%2Feasing-functions/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/smnandre%2Feasing-functions/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/smnandre%2Feasing-functions/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/smnandre","download_url":"https://codeload.github.com/smnandre/easing-functions/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":244584411,"owners_count":20476541,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["animation","cubic-bezier","easeinout","easing","easing-functions","function","no-deps","php","php-library","svg","timing","transition"],"created_at":"2025-01-25T10:12:27.426Z","updated_at":"2025-03-20T09:25:42.456Z","avatar_url":"https://github.com/smnandre.png","language":"PHP","readme":"\u003ch1 align=center\u003eEasing \u0026 Timing PHP Functions\u003c/h1\u003e\n\u003cimg src=\"./easing-functions.svg\" alt=\"Easing Functions\" align=\"center\"\u003e\n\u003cdiv align=\"center\"\u003e\u003cpre\u003ecomposer require smnandre/easing-functions\u003c/pre\u003e\u003c/div\u003e\n\u003cdiv align=\"center\"\u003e\n\n[![PHP Version](https://img.shields.io/badge/%C2%A0php-%3E%3D%208.3-777BB4.svg?logo=php\u0026logoColor=white)](https://github.com/smnandre/easing-functions/blob/main/composer.json)\n[![CI](https://github.com/smnandre/easing-functions/actions/workflows/CI.yaml/badge.svg)](https://github.com/smnandre/easing-functions/actions)\n[![Release](https://img.shields.io/github/v/release/smnandre/easing-functions)](https://github.com/smnandre/easing-functions/releases)\n[![License](https://img.shields.io/github/license/smnandre/easing-functions?color=cc67ff)](https://github.com/smnandre/easing-functions/blob/main/LICENSE)\n[![Codecov](https://codecov.io/gh/smnandre/easing-functions/graph/badge.svg?token=RC8Z6F4SPC)](https://codecov.io/gh/smnandre/easing-functions)\n\n\u003c/div\u003e\n\n---\n\n**EasingFunctions** is a **PHP library** that provides a collection of easing functions commonly used in animations, transitions, and smooth interpolations.\n\nIt includes standard easing equations: quadratic, cubic, quartic, quintic, sine, exponential, circular, elastic, and bounce functions.\n\nEach of them is available in three variations:\n* **In**: The motion starts slowly and accelerates.\n* **Out**: The motion starts quickly and decelerates.\n* **InOut**: A combination of both, accelerating at the start and decelerating at the end.\n\n## Easing Functions\n\n| x       |                               In                               |                                Out                                |                                   InOut                                 |\n|---------|:--------------------------------------------------------------:|:-----------------------------------------------------------------:|:-----------------------------------------------------------------------:|\n| Cubic   |    ![Ease In Cubic](img/easeInCubic.svg) \u003cbr\u003e `easeInCubic`    |    ![Ease Out Cubic](img/easeOutCubic.svg) \u003cbr\u003e `easeOutCubic`    |    ![Ease InOut Cubic](img/easeInOutCubic.svg) \u003cbr\u003e `easeInOutCubic`    |\n| Quart   |    ![Ease In Quart](img/easeInQuart.svg) \u003cbr\u003e `easeInQuart`    |    ![Ease Out Quart](img/easeOutQuart.svg) \u003cbr\u003e `easeOutQuart`    |    ![Ease InOut Quart](img/easeInOutQuart.svg) \u003cbr\u003e `easeInOutQuart`    |\n| Quad    |     ![Ease In Quad](img/easeInQuad.svg) \u003cbr\u003e `easeInQuad`      |     ![Ease Out Quad](img/easeOutQuad.svg) \u003cbr\u003e `easeOutQuad`      |     ![Ease InOut Quad](img/easeInOutQuad.svg) \u003cbr\u003e `easeInOutQuad`      |\n| Quint   |    ![Ease In Quint](img/easeInQuint.svg) \u003cbr\u003e `easeInQuint`    |    ![Ease Out Quint](img/easeOutQuint.svg) \u003cbr\u003e `easeOutQuint`    |    ![Ease InOut Quint](img/easeInOutQuint.svg) \u003cbr\u003e `easeInOutQuint`    |\n| Sine    |     ![Ease In Sine](img/easeInSine.svg) \u003cbr\u003e `easeInSine`      |     ![Ease Out Sine](img/easeOutSine.svg) \u003cbr\u003e `easeOutSine`      |     ![Ease InOut Sine](img/easeInOutSine.svg) \u003cbr\u003e `easeInOutSine`      |\n| Expo    |     ![Ease In Expo](img/easeInExpo.svg) \u003cbr\u003e `easeInExpo`      |     ![Ease Out Expo](img/easeOutExpo.svg) \u003cbr\u003e `easeOutExpo`      |     ![Ease InOut Expo](img/easeInOutExpo.svg) \u003cbr\u003e `easeInOutExpo`      |\n| Circ    |     ![Ease In Circ](img/easeInCirc.svg) \u003cbr\u003e `easeInCirc`      |     ![Ease Out Circ](img/easeOutCirc.svg) \u003cbr\u003e `easeOutCirc`      |     ![Ease InOut Circ](img/easeInOutCirc.svg) \u003cbr\u003e `easeInOutCirc`      |\n| Back    |     ![Ease In Back](img/easeInBack.svg) \u003cbr\u003e `easeInBack`      |     ![Ease Out Back](img/easeOutBack.svg) \u003cbr\u003e `easeOutBack`      |     ![Ease InOut Back](img/easeInOutBack.svg) \u003cbr\u003e `easeInOutBack`      |\n| Bounce  |  ![Ease In Bounce](img/easeInBounce.svg) \u003cbr\u003e `easeInBounce`   |  ![Ease Out Bounce](img/easeOutBounce.svg) \u003cbr\u003e `easeOutBounce`   |  ![Ease InOut Bounce](img/easeInOutBounce.svg) \u003cbr\u003e `easeInOutBounce`   |\n| Elastic | ![Ease In Elastic](img/easeInElastic.svg) \u003cbr\u003e `easeInElastic` | ![Ease Out Elastic](img/easeOutElastic.svg) \u003cbr\u003e `easeOutElastic` | ![Ease InOut Elastic](img/easeInOutElastic.svg) \u003cbr\u003e `easeInOutElastic` |\n\n\n\n## Installation\n\n```shell\ncomposer require smnandre/easing-functions\n```\n\n## Usage\n\n```php\nEasing\\Functions::easeOutCubic(0);\n// 0\nEasing\\Functions::easeOutCubic(0.5);\n// 0.875\n\n$values = array_map(Easing\\Functions::easeOutCubic(...), range(0, 1, 0.1));\necho implode(\" \", $values);\n// 0 0.271 0.488 0.657 0.784 0.875 0.936 0.973 0.992 0.999 1\n```\n\n## Functions\n\n### Easing Functions\n\n| Name             | Formulae                                                 | Preview                                            |\n|------------------|----------------------------------------------------------|----------------------------------------------------|\n| `easeOutCubic`   | $`1 - pow(1 - x, 3)`$                                    | ![easeOutCubic PHP](img/easeOutCubic_line.svg)     |\n| `easeInOutCubic` | $`x \u003c 0.5 ? 4 * pow(x, 3) : 1 - pow(-2 * x + 2, 3) / 2`$ | ![easeInOutCubic PHP](img/easeInOutCubic_line.svg) |\n| `easeInQuart`    | $`pow(x, 4)`$                                            | ![easeInQuart PHP](img/easeInQuart_line.svg)       |\n| `easeOutQuart`   | $`1 - pow(1 - x, 4)`$                                    | ![easeOutQuart PHP](img/easeOutQuart_line.svg)     |\n| `easeInOutQuart` | $`x \u003c 0.5 ? 8 * pow(x, 4) : 1 - pow(-2 * x + 2, 4) / 2`$ | ![easeInOutQuart PHP](img/easeInOutQuart_line.svg) |\n| `easeInCubic`    | $`pow(x, 3)`$                                            | ![easeInCubic PHP](img/easeInCubic_line.svg)       |\n| `easeInQuad`     | $`x * x`$                                                | ![easeInQuad PHP](img/easeInQuad_line.svg)         |\n| `easeOutQuad`    | $`1 - (1 - x) * (1 - x)`$                                | ![easeOutQuad PHP](img/easeOutQuad_line.svg)       |\n| `easeInOutQuad`  | $`x \u003c 0.5 ? 2 * x * x : 1 - pow(-2 * x + 2, 2) / 2`$     | ![easeInOutQuad PHP](img/easeInOutQuad_line.svg)   |\n| `easeInQuint`    | $`pow(x, 5)`$                                            | ![easeInQuint PHP](img/easeInQuint_line.svg)       |   \n| `easeOutQuint`   | $`1 - pow(1 - x, 5)`$                                    | ![easeOutQuint PHP](img/easeOutQuint_line.svg)     |\n| `easeInOutQuint` | $`x \u003c 0.5 ? 16 * pow(x, 5) : 1 - pow(-2 * x + 2, 5) / 2`$ | ![easeInOutQuint PHP](img/easeInOutQuint_line.svg) |\n| `easeInSine`     | $`1 - cos((x * pi()) / 2)`$                              | ![easeInSine PHP](img/easeInSine_line.svg)         |\n| `easeOutSine`    | $`sin((x * pi()) / 2)`$                                  | ![easeOutSine PHP](img/easeOutSine_line.svg)       |\n| `easeInOutSine`  | $`-(cos(pi() * x) - 1) / 2`$                            | ![easeInOutSine PHP](img/easeInOutSine_line.svg)   |\n| `easeInExpo`     | $`x == 0 ? 0 : pow(2, 10 * x - 10)`$                    | ![easeInExpo PHP](img/easeInExpo_line.svg)         |\n| `easeOutExpo`    | $`x == 1 ? 1 : 1 - pow(2, -10 * x)`$                    | ![easeOutExpo PHP](img/easeOutExpo_line.svg)       |\n| `easeInOutExpo`  | $`x == 0 ? 0 : x == 1 ? 1 : x \u003c 0.5 ? pow(2, 20 * x - 10) / 2 : (2 - pow(2, -20 * x + 10)) / 2`$ | ![easeInOutExpo PHP](img/easeInOutExpo_line.svg) |\n| `easeInCirc`     | $`1 - sqrt(1 - pow(x, 2))`$                             | ![easeInCirc PHP](img/easeInCirc_line.svg)         |\n| `easeOutCirc`    | $`sqrt(1 - pow(x - 1, 2))`$                             | ![easeOutCirc PHP](img/easeOutCirc_line.svg)       |\n| `easeInOutCirc`  | $`x \u003c 0.5 ? (1 - sqrt(1 - pow(2 * x, 2))) / 2 : (sqrt(1 - pow(-2 * x + 2, 2)) + 1) / 2`$ | ![easeInOutCirc PHP](img/easeInOutCirc_line.svg) |\n| `easeInBack`     | $`2.70158 * pow(x, 3) - 1.70158 * pow(x, 2)`$           | ![easeInBack PHP](img/easeInBack_line.svg)         |\n| `easeOutBack`    | $`1 + 2.70158 * pow(x - 1, 3) + 1.70158 * pow(x - 1, 2)`$ | ![easeOutBack PHP](img/easeOutBack_line.svg)       |\n| `easeInOutBack`  | $`x \u003c 0.5 ? (pow(2 * x, 2) * ((3.59258 * 2 * x) - 2.59258)) / 2 : (pow(2 * x - 2, 2) * ((3.59258 * (x * 2 - 2)) + 2.59258) + 2) / 2`$ | ![easeInOutBack PHP](img/easeInOutBack_line.svg) |\n| `easeInBounce`   | $`1 - easeOutBounce(1 - x)`$                            | ![easeInBounce PHP](img/easeInBounce_line.svg)     |\n| `easeOutBounce`  | See `bounceOut` function                                 | ![easeOutBounce PHP](img/easeOutBounce_line.svg)   |\n| `easeInOutBounce`| $`x \u003c 0.5 ? (1 - easeOutBounce(1 - 2 * x)) / 2 : (1 + easeOutBounce(2 * x - 1)) / 2`$ | ![easeInOutBounce PHP](img/easeInOutBounce_line.svg) |\n| `easeInElastic`  | $`x == 0 ? 0 : x == 1 ? 1 : -pow(2, 10 * x - 10) * sin((x * 10 - 10.75) * ((2 * pi()) / 3))`$ | ![easeInElastic PHP](img/easeInElastic_line.svg) |\n| `easeOutElastic` | $`x == 0 ? 0 : x == 1 ? 1 : pow(2, -10 * x) * sin((x * 10 - 0.75) * ((2 * pi()) / 3)) + 1`$ | ![easeOutElastic PHP](img/easeOutElastic_line.svg) |\n| `easeInOutElastic`| $`x == 0 ? 0 : x == 1 ? 1 : x \u003c 0.5 ? -(pow(2, 20 * x - 10) * sin((20 * x - 11.125) * ((2 * pi()) / 4.5))) / 2 : (pow(2, -20 * x + 10) * sin((20 * x - 11.125) * ((2 * pi()) / 4.5))) / 2 + 1`$ | ![easeInOutElastic PHP](img/easeInOutElastic_line.svg) |\n\n## License\n\nThis project is licensed under the MIT License. See the [LICENSE](./LICENSE) file for more information.\n","funding_links":["https://github.com/sponsors/smnandre"],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsmnandre%2Feasing-functions","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsmnandre%2Feasing-functions","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsmnandre%2Feasing-functions/lists"}