{"id":13786174,"url":"https://github.com/Geri-Borbas/Unity.Library.eppz_easing","last_synced_at":"2025-05-11T22:30:44.614Z","repository":{"id":23971678,"uuid":"27354290","full_name":"Geri-Borbas/Unity.Library.eppz_easing","owner":"Geri-Borbas","description":"Easing algorithms with explanations / testbed.","archived":false,"fork":false,"pushed_at":"2014-12-27T19:31:06.000Z","size":3752,"stargazers_count":19,"open_issues_count":0,"forks_count":4,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-04-22T13:49:51.492Z","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/Geri-Borbas.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}},"created_at":"2014-11-30T23:36:37.000Z","updated_at":"2025-02-03T11:53:35.000Z","dependencies_parsed_at":"2022-08-22T01:40:43.061Z","dependency_job_id":null,"html_url":"https://github.com/Geri-Borbas/Unity.Library.eppz_easing","commit_stats":null,"previous_names":["eppz/unity.library.eppz_easing"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Geri-Borbas%2FUnity.Library.eppz_easing","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Geri-Borbas%2FUnity.Library.eppz_easing/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Geri-Borbas%2FUnity.Library.eppz_easing/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Geri-Borbas%2FUnity.Library.eppz_easing/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Geri-Borbas","download_url":"https://codeload.github.com/Geri-Borbas/Unity.Library.eppz_easing/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":253645092,"owners_count":21941311,"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:11.001Z","updated_at":"2025-05-11T22:30:43.114Z","avatar_url":"https://github.com/Geri-Borbas.png","language":"C#","readme":"EPPZEasing\n----------\n\nSimplified / normalized easign algorithms.\n\nFunctions here **take a (mostly linear / normalized) input value, then spits out an eased output**, so are not coupled to time or animation directly.\n\n![eppz! easing algorithms](http://eppz.eu/blog/wp-content/uploads/Easing_algorithms_eppz.jpg)\n\n#### Usage\n\nOnce you have a normalized completion (a value between 0 and 1), or any kind of percentage somewhere in your code, you can just ease it as you like, then go along with the rest of the application.\n\nCan be applied to any `float` using extension methods.\n```C#\nfloat easedCompletion = completion.ValueWithEasingType(EasingType.Ease_In_Out_Bounce_3);\n```\n\nOr you can use easing instances directly.\n```C#\nfloat easedCompletion = currentEasing.ValueForInput(completion);\n```\n\nEasing objects gets allocated once, then pooled at runtime. You can access them using static accessor.\n```\nEPPZEasing currentEasing = EPPZEasing.EasingForType(EasingType.Ease_In_Out_Circular);\n```\n\nNeed only a single file called **[`EPPZEasing.cs`](https://github.com/eppz/eppz.easing/blob/master/Assets/EPPZEasing.cs)**.\n\n#### Simplicity\n\nThe code for EPPZEasing.Linear goes like:\n```C#\nreturn input; // :)\n```\n\nCompared to the usual easing implementations, like:\n```C#\nreturn valueChange * currentTime / duration + startValue;\n```\n\nWhile this is all fine above, it feels way too specific for me, as beside easing, it implements value changing over time, also forces you to normalize time in this manner. If you want to change 6 values at once, you have to ease each an every value.\n\n\n#### Documentation\n\nThe code is mostly self documented, you can see actual easing algorithms with some explanations within the class bodies (implemented for testbed scene in the first place).\n\n```C#\npublic class EPPZEasing_Ease_Out_Bounce_3 : EPPZEasing\n{\n\tpublic override EasingType type { get { return EasingType.Ease_Out_Bounce_3; } }\n\tpublic override string name { get { return \"Ease_Out_Bounce_3\"; } }\n\tpublic override string description { get { return \"Inverse offset power composition\"; } }\n\tpublic override string algorithm { get { return \"y = 1 - (4(1 - x)^3 - 3(1 - x)^2)\"; } }\n\tpublic override string simplifiedAlgorithm { get { return \"y = x(x(4x-9)+6)\"; } }\n\tpublic override float ValueForInput(float x)\n\t{\n\t\treturn x * ( x * (4 * x - 9 ) + 6);\n\t}\n}\n```\n\n\n#### Algorithms\n\nFor easy reference, find the equations (and simplifications) implemented so far below.\n\n```C#\n// Linear\ny = x\n\n// Ease_In\ny = x^2\n\n// Ease_In_2\ny = x^3\n\n// Ease_In_3\ny = x^8\n\n// Ease_Out\ny = 1-(1-x)^2\n\n// Ease_Out_2\ny = 1-(1-x)^3\n\n// Ease_Out_3\ny = 1-(1-x)^8\n\n// Ease_In_Out\ny = (x\u003c0.5) ? (2x)^2/2 : 0.5+(1-(2(1-x))^2)/2\ny = (x\u003c0.5) ? 2x^2 : -2x^2+4x-1\n\n// Ease_In_Out_2\ny = (x\u003c0.5) ? (2x)^3/2 : 0.5+(1-(2(1-x))^3)/2\ny = (x\u003c0.5) ? 4x^3 : 4x^3-12x^2+12x-3\n\n// Ease_In_Out_3\ny = (x\u003c0.5) ? (2x)^8/2 : 0.5+(1-(2(1-x))^8)/2\ny = (x\u003c0.5) ? 128x^8 : 0.5+(1-(2(1-x))^8)/2\n\n// Ease_In_Circular\ny = 1-sqrt(1-x^2)\n\n// Ease_Out_Circular\ny = sqrt(1-(1-x)^2)\ny = sqrt(-(x-2)x)\n\n// Ease_In_Out_Circular\ny = (x\u003c0.5) ? (1-sqrt(1-(2x)^2))/2 : 0.5+sqrt(1-((2(1-x))^2))/2\ny = (x\u003c0.5) ? 0.5(1-sqrt(1-4x^2)) : 0.5(sqrt(-4(x-2)x-3)+1)\n\n// Ease_In_Bounce\ny = 2x^3-x^2\ny = x^2(2x-1)\n\n// Ease_In_Bounce_2\ny = 3x^3-2x^2\ny = x^2(3x-2)\n\n// Ease_In_Bounce_3\ny = 4x^3-3x^2\ny = x^2(4x-3)\n\n// Ease_Out_Bounce\ny = 1-(2(1-x)^3-(1-x)^2)\ny = x(x(2x-5)+4)\n\n// Ease_Out_Bounce_2\ny = 1-(3(1-x)^3-2(1-x)^2)\ny = x(x(3x-7)+5)\n\n// Ease_Out_Bounce_3\ny = 1-(4(1-x)^3-3(1-x)^2)\ny = x(x(4x-9)+6)\n\n// Ease_In_Out_Bounce\ny = (x\u003c0.5) ? (2(2x)^3-(2x)^2)*0.5 : 1-(2(2(1-x))^3-(2(1-x))^2)*0.5\ny = (x\u003c0.5) ? 8x^3-2x^2 : 8x^3-22x^2+20x-5\n\n// Ease_In_Out_Bounce_2\ny = (x\u003c0.5) ? (3(2x)^3-2(2x)^2)*0.5 : 1-(3(2(1-x))^3-2(2(1-x))^2)*0.5\ny = (x\u003c0.5) ? 12x^3-4x^2 : 12x^3-32x^2+28x-7\n\n// Ease_In_Out_Bounce_3\ny = (x\u003c0.5) ? (4(2x)^3-3(2x)^2)*0.5 : 1-(4(2(1-x))^3-3(2(1-x))^2)*0.5\ny = (x\u003c0.5) ? 16x^3-6x^2 : 16x^3-42x^2+36x-9\n```\n\nYou can see them in action in any plot service like http://fooplot.com/, or simply copy equation to Google search bar.\n\n\n#### Next\n\nPlanning to render a set of samples to be able to get interpolated values for performance considerations. As another option to cahce, render samples into a texture suitable for shader inputs. Also give full control over the values of these presets, option to blend different easings.\n\n\n#### License\n\n\u003e Licensed under the [Open Source MIT license](http://en.wikipedia.org/wiki/MIT_License).\n","funding_links":[],"categories":["Easing"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FGeri-Borbas%2FUnity.Library.eppz_easing","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FGeri-Borbas%2FUnity.Library.eppz_easing","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FGeri-Borbas%2FUnity.Library.eppz_easing/lists"}