object:to(delay-in-ms, {action1, action2, action3, ...}, easing, loop, reverse)
object
This is a reference to an object, you can assign a short notation variable to make it easier to call functions on this object:local object = game.CurrentScene.SceneObjects["some_object_name"]
delay-in-ms
The amount of time it takes to perform the transition (1000 ms = 1 second).
actions
A comma-separated list of actions to perform during this transition period, including:
- Visibility
- Rotation
- AnimationSize
- AnimationCurrentPosition
- ...more...
easing
Specify the type of curve used for the transition. This allows the start or end of the transition to be slower or faster, to bounce or overshoot slightly, etc.
The following easing types are available:
- Linear
- Sine
- Quad
- Cubic
- Quart
- Quint
- Expo
- Circ
- Back
- Elastic
- Bounce
Animated examples of easings can be viewed from: http://easings.net/
Note: Linear is not listed on that web site, but refers to an even transition speed, no slowing down or speeding up.
Easings may appear at the start of the transformation "In", at the end of the transition "Out", or at both the start and end "InOut".
Full list of easings:
- easeLinearIn / easeLinearOut / easeLinearInOut
- easeSineIn / easeSineOut / easeSineInOut
- easeQuadIn / easeQuadOut / easeQuadInOut
- easeCubicIn / easeCubicOut / easeCubicInOut
- easeQuartIn / easeQuartOut / easeQuartInOut
- easeQuintIn / easeQuintOut / easeQuintInOut
- easeExpoIn / easeExpoOut / easeExpoInOut
- easeCircIn / easeCircOut / easeCircInOut
- easeBackIn / easeBackOut / easeBackInOut
- easeElasticIn / easeElasticOut / easeElasticInOut
- easeBounceIn / easeBounceOut / easeBounceInOut
Note: I am not sure if there is a way to chain multiple easings together, such as "ExpoIn + BounceOut".
loop
Once the transition is finished, does it immediately repeat again from the start?
True/False.
reverse
Once the transition is finished, does it then go backwards until it gets back to the start?
True/False.
Visibility
Specify the percentage of visibility, 0-100.
Note 1: Goes from 0.0% (fully invisible) to 100.0% (fully visibile).
Note 2: Fractional is fine, e.g. "33.333" or "100/3".object:to(750, {Visibility = 0}, easeExpoIn, true, true)
This will spend 3/4 seconds fading object to hidden, then 3/4 seconds fading back to visible, then keep repeating itself.
Rotation
First choose the centre point to use when rotating the image, such as:object.RotationCenter = {x = -1, y = -1}
Note: Using -1, -1 for the coordinates will use the centre of the image.
Next perform the rotation transformation:object:to(5000, {Rotation = math.rad(360)}, easeLinearInOut, false, false)
This will spend 5 seconds rotating the object 360 degrees, using a constant / linear speed, then will stop.
Note 1: Rotation degrees are specified in radians, use the math.rad() function to convert degrees to radians.
Note 2: You can specify large amounts of rotation, such as 720 degrees, to rotate multiple times.
Note 3: If you specify negative degrees, the object will rotate counter-clockwise.
game.CurrentScene:to(1000, {SceneMusicVolume = 0}) -- fade background music volume of current scene to 0%
game.CurrentScene:to(1000, {SceneBrightness = 0})
Interfaces["inventory"]:to(500, { InterfaceOffset = {x=0, y = Interfaces["inventory"].InterfaceOffset.y} }, easeBounceOut)
Btw these books are a completely hidden thing or is there some link to access them which i overlooked? They also seems to be in german only.
ActiveAnimations["example"]:to(1000, { AnimationCurrentPosition = {x = 500, y = 500}, easeQuintOut)
game.CurrentScene.SceneObjects["example"]:to(10000, {ObjectScale = 1.3}, easeLinearInOut, true, true) -- scale object up & down in a loop
local object = Objects["grass_1"]
object:to(2000, {Rotation = math.rad(20)}, easeSineInOut, true, true)