Skip to content

Instantly share code, notes, and snippets.

@jocafa
Created August 9, 2021 04:50
Show Gist options
  • Save jocafa/a5a2953a0e9b68bfe32d7b169d2485e7 to your computer and use it in GitHub Desktop.
Save jocafa/a5a2953a0e9b68bfe32d7b169d2485e7 to your computer and use it in GitHub Desktop.
-- https://gist.github.com/gre/1650294
ease = {}
ease.linear = function (t) return t end
ease.inQuad = function (t) return t*t end
ease.outQuad = function (t) return t*(2-t) end
ease.inOutQuad = function (t) return t<0.5 and 2*t*t or -1+(4-2*t)*t end
ease.inCubic = function (t) return t*t*t end
ease.outCubic = function (t) t = t-1; return t*t*t+1 end
ease.inOutCubic = function (t) return t<0.5 and 4*t*t*t or (t-1)*(2*t-2)*(2*t-2)+1 end
ease.inQuart = function (t) return t*t*t*t end
ease.outQuart = function (t)
t = t-1
return 1-t*t*t*t
end
ease.inOutQuart = function (t)
if t<0.5 then
return 8*t*t*t*t
else
t=t-1
return 1-8*t*t*t*t
end
end
ease.inQuint = function (t) return t*t*t*t*t end
ease.outQuint = function (t)
t=t-1
return 1+t*t*t*t*t
end
ease.inOutQuint = function (t)
if t<0.5 then
return 16*t*t*t*t*t
else
t=t-1
return 1+16*t*t*t*t*t
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment