gre.animation_stop
gre.animation_stop(animation_id, data)
--OR
gre.animation_stop("animation_name")
Stop an animation. If an animation_id is used to stop the animation, then it must be the return value from gre.animation_create(). If a name is used to stop an animation, then that name must be the name of the animation specified in Designer. This function can take an optional parameter, data_table. The data_table contains the tags and values for the extra arguments to set.
Parameters
| Parameter | Type | Description |
|---|---|---|
animation_id | #string | The animation to stop |
data | #table | [Optional] A table containing the tags and values for the extra (see Animation Data) |
Animation Data
| Parameter | Type | Description |
|---|---|---|
id | #string | The animation id used in the case of multiple animations with the same name |
context | #string | The fully qualified name of an object in the model which will be used as the context for the animation. |
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, 1)
data["rate"] = "linear"
data["duration"] = 2000
data["offset"] = 0
data["delta"] = 400
data["key"] = "mylayer.mycontrol.grd_x"
gre.animation_add_step(id, data)
gre.animation_trigger(id)
--do stuff
--Stop the animation
gre.animation_stop(id)
end
--Example of using gre.animation_stop passing animation names.
function cb_stop_cur_5day()
if cur_5day_toggle == false then
gre.animation_stop("show_5day")
else
gre.animation_stop("hide_mon_to_fri")
end
end
--Example of using gre.animation_stop with context.
function cb_toggle_cur_5day()
local data = {}
data["context"] = "Layer1.mycontrol"
gre.animation_stop("show_5day", data)
end