{"id":13786164,"url":"https://github.com/rakkarage/Ease","last_synced_at":"2025-05-11T22:30:47.715Z","repository":{"id":25157150,"uuid":"28579939","full_name":"rakkarage/Ease","owner":"rakkarage","description":"Simple Unity3D Easing","archived":false,"fork":false,"pushed_at":"2023-08-08T00:41:46.000Z","size":282,"stargazers_count":31,"open_issues_count":0,"forks_count":4,"subscribers_count":5,"default_branch":"master","last_synced_at":"2024-11-11T03:48:56.015Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"C#","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/rakkarage.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null}},"created_at":"2014-12-29T04:13:18.000Z","updated_at":"2024-09-02T23:32:45.000Z","dependencies_parsed_at":"2024-01-17T05:14:00.074Z","dependency_job_id":"46ac10ff-fea9-46ee-b61c-941ac052e97d","html_url":"https://github.com/rakkarage/Ease","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rakkarage%2FEase","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rakkarage%2FEase/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rakkarage%2FEase/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rakkarage%2FEase/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/rakkarage","download_url":"https://codeload.github.com/rakkarage/Ease/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":225101173,"owners_count":17421073,"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":[],"created_at":"2024-08-03T19:01:10.781Z","updated_at":"2024-11-17T22:31:47.874Z","avatar_url":"https://github.com/rakkarage.png","language":"C#","readme":"# Ease\n\nSimple Unity Easing\n\nThe following easing functions are available for various animation effects:\n\n```csharp\npublic enum EaseType\n{\n    Linear,\n    SineIn, SineOut, SineInOut,\n    QuadIn, QuadOut, QuadInOut,\n    CubicIn, CubicOut, CubicInOut,\n    QuartIn, QuartOut, QuartInOut,\n    QuintIn, QuintOut, QuintInOut,\n    ExpoIn, ExpoOut, ExpoInOut,\n    CircIn, CircOut, CircInOut,\n    BackIn, BackOut, BackInOut,\n    ElasticIn, ElasticOut, ElasticInOut,\n    BounceIn, BounceOut, BounceInOut,\n    Spring\n}\n```\n\n## Example usage\n```csharp\nusing ca.HenrySoftware.Rage;\nusing UnityEngine;\nusing UnityEngine.UI;\npublic class TestEase : MonoBehaviour\n{\n\t[SerializeField] private Image _slowStatus = null;\n\tprivate bool _slow;\n\t[SerializeField] private Image _pauseStatus = null;\n\tprivate bool _pause;\n\t[SerializeField] private Image _fastStatus = null;\n\tprivate bool _fast;\n\tprivate readonly Color _colorOff = Color.white.SetAlpha(.75f);\n\tprivate readonly Color _colorOn = Color.blue.SetAlpha(.75f);\n\tprivate readonly Vector3 _scaleTo = new Vector3(1.333f, 1.333f, 1f);\n\tprivate const float _time = .333f;\n\tprivate void Start()\n\t{\n\t\t_slowStatus.color = _colorOff;\n\t\t_pauseStatus.color = _colorOff;\n\t\t_fastStatus.color = _colorOff;\n\t}\n\tpublic void Slow()\n\t{\n\t\t_pause = false;\n\t\t_pauseStatus.color = _colorOff;\n\t\t_fast = false;\n\t\t_fastStatus.color = _colorOff;\n\t\tTime.timeScale = (_slow = !_slow) ? .1f : 1f;\n\t\t_slowStatus.StopAllCoroutines();\n\t\tEase3.GoColorTo(_slowStatus, (_slow ? _colorOn : _colorOff).GetVector3(), _time, null, null, EaseType.SineInOut, 0f, 1, false, true);\n\t\tEase3.GoScaleTo(_slowStatus, _scaleTo, _time, null, () =\u003e\n\t\t{\n\t\t\tEase3.GoScaleTo(_slowStatus, Vector3.one, _time, null, null, EaseType.BackInOut, 0f, 1, false, true);\n\t\t}, EaseType.BackInOut, 0f, 1, false, true);\n\t}\n\tpublic void Pause()\n\t{\n\t\tTime.timeScale = (_pause = !_pause) ? 0f : _slow ? .1f : _fast ? 2f : 1f;\n\t\t_pauseStatus.StopAllCoroutines();\n\t\tEase3.GoColorTo(_pauseStatus, (_pause ? _colorOn : _colorOff).GetVector3(), _time, null, null, EaseType.SineInOut, 0f, 1, false, true);\n\t\tEase3.GoScaleTo(_pauseStatus, _scaleTo, _time, null, () =\u003e\n\t\t{\n\t\t\tEase3.GoScaleTo(_pauseStatus, Vector3.one, _time, null, null, EaseType.BackInOut, 0f, 1, false, true);\n\t\t}, EaseType.BackInOut, 0f, 1, false, true);\n\t}\n\tpublic void Fast()\n\t{\n\t\t_slow = false;\n\t\t_slowStatus.color = _colorOff;\n\t\t_pause = false;\n\t\t_pauseStatus.color = _colorOff;\n\t\tTime.timeScale = (_fast = !_fast) ? 2f : 1f;\n\t\t_fastStatus.StopAllCoroutines();\n\t\tEase3.GoColorTo(_fastStatus, (_fast ? _colorOn : _colorOff).GetVector3(), _time, null, null, EaseType.SineInOut, 0f, 1, false, true);\n\t\tEase3.GoScaleTo(_fastStatus, _scaleTo, _time, null, () =\u003e\n\t\t{\n\t\t\tEase3.GoScaleTo(_fastStatus, Vector3.one, _time, null, null, EaseType.BackInOut, 0f, 1, false, true);\n\t\t}, EaseType.BackInOut, 0f, 1, false, true);\n\t}\n}\n\n```\n\n## Documentation\n### Ease\n\nThe `Ease` class provides a collection of easing functions and utility methods for creating smooth animations in Unity. Ease either a float, or the alpha value of UI components.\n\n#### Ease.Go\nInitiates a coroutine-based animation with specified parameters.\n\n```csharp\nIEnumerator Go(MonoBehaviour m, float from, float to, float time,\n    Action\u003cfloat\u003e update, Action complete = null, EaseType type = EaseType.Linear,\n    float delay = 0f, int repeat = 1, bool pingPong = false, bool realTime = false)\n```\n\n#### Ease.GoAlpha\nInitiates an alpha animation with specified parameters.\n\n```csharp\nIEnumerator GoAlpha(MonoBehaviour m, float from, float to, float time,\n    Action\u003cfloat\u003e update, Action complete = null, EaseType type = EaseType.Linear,\n    float delay = 0f, int repeat = 1, bool pingPong = false, bool realTime = false)\n```\n\n#### Ease.GoAlphaTo\nInitiates an alpha animation to the specified value.\n\n```csharp\nIEnumerator GoAlphaTo(MonoBehaviour m, float to, float time,\n    Action\u003cfloat\u003e update = null, Action complete = null, EaseType type = EaseType.Linear,\n    float delay = 0f, int repeat = 1, bool pingPong = false, bool realTime = false)\n```\n\n#### Ease.GoAlphaBy\nInitiates an alpha animation by the specified value.\n\n```csharp\nIEnumerator GoAlphaBy(MonoBehaviour m, float by, float time,\n    Action\u003cfloat\u003e update = null, Action complete = null, EaseType type = EaseType.Linear,\n    float delay = 0f, int repeat = 1, bool pingPong = false, bool realTime = false)\n```\n\n### Ease3\nThe `Ease3` class provides static methods for performing easing animations on Vector3 or transform\n\n#### Ease3.Go\nStarts an easing animation on a `Vector3` property from a starting value to an ending value.\n\n```csharp\nIEnumerator Go(MonoBehaviour m, Vector3 from, Vector3 to, float time,\n    Action\u003cVector3\u003e update, Action complete = null, EaseType type = EaseType.Linear,\n    float delay = 0f, int repeat = 1, bool pingPong = false, bool realTime = false)\n```\n\n#### Ease3.GoPosition\nStarts an easing animation on the local position from a starting value to an ending value.\n\n```csharp\nIEnumerator GoPosition(MonoBehaviour m, Vector3 from, Vector3 to, float time,\n    Action\u003cVector3\u003e update = null, Action complete = null, EaseType type = EaseType.Linear,\n    float delay = 0f, int repeat = 1, bool pingPong = false, bool realTime = false)\n```\n\n#### Ease3.GoPositionTo\nStarts an easing animation on the local position of a Unity object to a specific value.\n\n```csharp\nIEnumerator GoPositionTo(MonoBehaviour m, Vector3 to, float time,\n    Action\u003cVector3\u003e update = null, Action complete = null, EaseType type = EaseType.Linear,\n    float delay = 0f, int repeat = 1, bool pingPong = false, bool realTime = false)\n```\n\n#### Ease3.GoPositionBy\nStarts an easing animation on the local position of a Unity object by a specific value.\n```csharp\nIEnumerator GoPositionBy(MonoBehaviour m, Vector3 by, float time,\n    Action\u003cVector3\u003e update = null, Action complete = null, EaseType type = EaseType.Linear,\n    float delay = 0f, int repeat = 1, bool pingPong = false, bool realTime = false)\n```\n\n#### Ease3.GoRotation\nStarts an easing animation on the local rotation of a Unity object from a starting value to an ending value.\n\n```csharp\nIEnumerator GoRotation(MonoBehaviour m, Vector3 from, Vector3 to, float time,\n    Action\u003cVector3\u003e update = null, Action complete = null, EaseType type = EaseType.Linear,\n    float delay = 0f, int repeat = 1, bool pingPong = false, bool realTime = false)\n```\n\n#### Ease3.GoRotationTo\nStarts an easing animation on the local rotation of a Unity object to a specific value.\n```csharp\nIEnumerator GoRotationTo(MonoBehaviour m, Vector3 to, float time,\n    Action\u003cVector3\u003e update = null, Action complete = null, EaseType type = EaseType.Linear,\n    float delay = 0f, int repeat = 1, bool pingPong = false, bool realTime = false)\n```\n#### Ease3.GoRotationBy\nStarts an easing animation on the local rotation of a Unity object by a specific value.\n\n```csharp\nIEnumerator GoRotationBy(MonoBehaviour m, Vector3 by, float time,\n    Action\u003cVector3\u003e update = null, Action complete = null, EaseType type = EaseType.Linear,\n    float delay = 0f, int repeat = 1, bool pingPong = false, bool realTime = false)\n```\n\n#### Ease3.GoScale\nStarts an easing animation on the local scale of a Unity object from a starting value to an ending value.\n\n```csharp\nIEnumerator GoScale(MonoBehaviour m, Vector3 from, Vector3 to, float time,\n    Action\u003cVector3\u003e update = null, Action complete = null, EaseType type = EaseType.Linear,\n    float delay = 0f, int repeat = 1, bool pingPong = false, bool realTime = false)\n```\n\n#### Ease3.GoScaleTo\nStarts an easing animation on the local scale of a Unity object to a specific value.\n\n```csharp\nIEnumerator GoScaleTo(MonoBehaviour m, Vector3 to, float time,\n    Action\u003cVector3\u003e update = null, Action complete = null, EaseType type = EaseType.Linear,\n    float delay = 0f, int repeat = 1, bool pingPong = false, bool realTime = false)\n```\n#### Ease3.GoScaleBy\nStarts an easing animation on the local scale of a Unity object by a specific value.\n\n```csharp\nIEnumerator GoScaleBy(MonoBehaviour m, Vector3 by, float time,\n    Action\u003cVector3\u003e update = null, Action complete = null, EaseType type = EaseType.Linear,\n    float delay = 0f, int repeat = 1, bool pingPong = false, bool realTime = false)\n```\n\n#### Ease3.GoColor\nStarts an easing animation on the color of a Image component or the background color of the main camera from a starting value to an ending value.\n\n```csharp\nIEnumerator GoColor(MonoBehaviour m, Vector3 from, Vector3 to, float time,\n    Action\u003cVector3\u003e update = null, Action complete = null, EaseType type = EaseType.Linear,\n    float delay = 0f, int repeat = 1, bool pingPong = false, bool realTime = false)\n```\n\n#### Ease3.GoColorTo\nStarts an easing animation on the color of a Image component or the background color of the main camera to a specific value.\n\n```csharp\nIEnumerator GoColorTo(MonoBehaviour m, Vector3 to, float time,\n    Action\u003cVector3\u003e update = null, Action complete = null, EaseType type = EaseType.Linear,\n    float delay = 0f, int repeat = 1, bool pingPong = false, bool realTime = false)\n```\n\n#### Ease3.GoColorBy\nStarts an easing animation on the color of a Image component or the background color of the main camera by a specific value.\n\n```csharp\nIEnumerator GoColorBy(MonoBehaviour m, Vector3 by, float time,\n    Action\u003cVector3\u003e update = null, Action complete = null, EaseType type = EaseType.Linear,\n    float delay = 0f, int repeat = 1, bool pingPong = false, bool realTime = false)\n```\n\n### Ease4\nThe `Ease4` class provides static methods for performing easing animations on Vector4 properties, including color animations for Image components and camera backgrounds.\n\n#### Ease4.Go\nStarts an easing animation on a Vector4 property from a starting value to an ending value.\n\n```csharp\nIEnumerator Go(MonoBehaviour m, Vector4 from, Vector4 to, float time,\n    Action\u003cVector4\u003e update, Action complete = null, EaseType type = EaseType.Linear,\n    float delay = 0f, int repeat = 1, bool pingPong = false, bool realTime = false)\n```\n\n#### Ease4.GoColor\nStarts an easing animation on the color of an Image component or the background color of the main camera.\n\n```csharp\nIEnumerator GoColor(MonoBehaviour m, Vector4 from, Vector4 to, float time,\n    Action\u003cVector4\u003e update = null, Action complete = null, EaseType type = EaseType.Linear,\n    float delay = 0f, int repeat = 1, bool pingPong = false, bool realTime = false)\n```\n\n#### Ease4.GoColorTo\nStarts an easing animation on the color of an Image component or the background color of the main camera to a specific value.\n\n```csharp\nIEnumerator GoColorTo(MonoBehaviour m, Vector4 to, float time,\n    Action\u003cVector4\u003e update = null, Action complete = null, EaseType type = EaseType.Linear,\n    float delay = 0f, int repeat = 1, bool pingPong = false, bool realTime = false)\n```\n#### Ease4.GoColorBy\nStarts an easing animation on the color of an Image component or the background color of the main camera by a specific value.\n\n```csharp\nIEnumerator GoColorBy(MonoBehaviour m, Vector4 by, float time,\n    Action\u003cVector4\u003e update = null, Action complete = null, EaseType type = EaseType.Linear,\n    float delay = 0f, int repeat = 1, bool pingPong = false, bool realTime = false)\n```\n\n### Extension methods\nVectors are used as parameters for the above methods instead of Color objects. To help with converting between Colors and Vectors, extension methods are made available: `Vector3.GetColor()`, `Vector4.GetColor()`, `Color.GetVector3()`, `Color.GetVector4()`, `Color.SetAlpha(float alpha)`.\n\n### Easing functions\n\nEasing functions provide a convenient way to interpolate values smoothly over time. These functions define how the intermediate values between a start and an end point are calculated based on a time factor.\n\nEasing functions are provided as static methods in the `Ease` class. To use an easing function, simply call the corresponding method and provide the required parameters:\n\n```csharp\nusing ca.HenrySoftware.Rage;\n\nfloat startValue = 0.0f;\nfloat endValue = 1.0f;\nfloat time = 0.5f; // Progress of the interpolation, usually between 0 and 1\n\nfloat interpolatedValue = Ease.QuadInOut(startValue, endValue, time);\n\nDebug.Log(interpolatedValue); // Output: 0.5\n```","funding_links":[],"categories":["Easing"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frakkarage%2FEase","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frakkarage%2FEase","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frakkarage%2FEase/lists"}