Last active
December 30, 2017 20:49
-
-
Save badcc/4a2316ec0404d7e2b08b030baf02d2ae to your computer and use it in GitHub Desktop.
Simple, clean easing functions in Lua. Will add more as I need them.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- Input: Time value scaled [0,1] | |
-- Output: Transformed time value | |
local function Ease_InOutQuad(t) | |
return t<0.5 and 2*t*t or -1-2*(t-2)*t | |
end | |
local function Ease_OutQuad(t) | |
return -(t-2)*t | |
end | |
local function Ease_InBack(t) | |
local s = 1.70158 | |
return t*t*(s*(t-1)+t) | |
end | |
local function Ease_OutBack(t) | |
local s = 1.70158 | |
return 1+(t-1)*(t-1)*(-1+t+s*t) | |
end | |
local function Ease_InOutBack(t) | |
local s = 2.59491 | |
return t<0.5 and 2*t*t*(-s+2*(1+s)*t) or 1+2*(t-1)*(t-1)*(-2-s+2*(1+s)*t) | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment