Module: ease
This module allows you to modify values over a given period of time and following different variation curves.
-- A few examples: local t = {x = 0.0} -- All ease functions return an instance controlling how -- values change over time, and on what duration: local instance = ease:inSine(t, 1.0) instance.x = 10.0 -- x will go from 0 to 10 in 1 second following inSine curve --- -- It's also possible to do this in one line: ease:inSine(t, 1.0).x = 10.0 --- -- The returned instance is useful to cancel the movement: local instance = ease:outBack(someShape, 12.0) instance.Position = {10, 10, 10} instance:cancel() --- -- An optional easeConfig table can be provided when creating easing instances: local callback = function() print("done animating") end local config = { onDone = callback } -- triggers `callback` when done (after 1 second) ease:inSine(t, 1.0, config)
ease
Functions
Go to target value(s) following inBack curve.
ease:inBack(someObject, 1.0).Position = {10, 10, 10}
Go to target value(s) following inElastic curve.
ease:inElastic(someObject, 1.0).Position = {10, 10, 10}
Go to target value(s) following inOutQuad curve.
ease:inOutQuad(someObject, 1.0).Position = {10, 10, 10}
Go to target value(s) following inOutSine curve.
ease:inOutSine(someObject, 1.0).Position = {10, 10, 10}
Go to target value(s) following inQuad curve.
ease:inQuad(someObject, 1.0).Position = {10, 10, 10}
Go to target value(s) following inSine curve.
local t = {x = 0.0} local instance = ease:inSine(t, 1.0) intance.x = 2.0 -- x will go from 0 to 2 in 1 second -- in one line: ease:inSine(someObject, 1.0).Position = {10, 10, 10}
Go to target value(s) following linear curve.
ease:linear(someObject, 1.0).Position = {10, 10, 10}
Go to target value(s) following outBack curve.
ease:outBack(someObject, 1.0).Position = {10, 10, 10}
Go to target value(s) following outElastic curve.
ease:outElastic(someObject, 1.0).Position = {10, 10, 10}
Go to target value(s) following outQuad curve.
ease:outQuad(someObject, 1.0).Position = {10, 10, 10}
Go to target value(s) following outSine curve.
ease:outSine(someObject, 1.0).Position = {10, 10, 10}
easeInstance
An easeInstance is a table returned by all ease functions to provide control over the ongoing animation.
Functions
Cancels easing when called.
local instance = ease:outBack(someObject, 1.0).Position = {10, 10, 10} instance:cancel()