Skip to main content
Version: 9.0.2

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

ParameterTypeDescription
id#numberThe animation id
data#tableA table of animation step values which can include (See Animation Step Table)

Animation Step Table

KeyTypeValue
key#stringThe data key for the animation step to be enacted upon.
rate#stringThe animation rate string: linear, easein, easeout, easeinout or bounce.
duration#numberThe length of the step (ms)
offset#numberThe offset from animation start where this step begins (ms).
from#string, #number or #booleanThe value to start the animation at, if not specified the value is the current value of "key".
to#string, #number or #booleanThe end point for the animation.
delta#numberThe 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