gre.animation_add_step
gre.animation_add_step(id, data)
Add a step to a created animation. The id must be from a call to gre.animation_create. The data parameter defines the animation step values.
Parameters
| Parameter | Type | Description |
|---|---|---|
id | #number | The animation id |
data | #table | A table of animation step values which can include (See Animation Step Table) |
Animation Step Table
| Key | Type | Value |
|---|---|---|
key | #string | The data key for the animation step to be enacted upon. |
rate | #string | The animation rate string: linear, easein, easeout, easeinout or bounce. |
duration | #number | The length of the step (ms) |
offset | #number | The offset from animation start where this step begins (ms). |
from | #string, #number or #boolean | The value to start the animation at, if not specified the value is the current value of "key". |
to | #string, #number or #boolean | The end point for the animation. |
delta | #number | The delta for the end of the animation from the start point. If both "to" and "delta" are given then the "to" value is used. |
Example
function create_animation(mapargs)
local data = {}
-- slide the x position 400 pixels over 2000 ms and auto-destroy
-- it on completion
id = gre.animation_create(60, true)
data["rate"] = "linear"
data["duration"] = 2000
data["offset"] = 0
data["delta"] = 400
data["key"] = "mylayer.mycontrol.grd_x"
gre.animation_add_step(id, data)
end