gre.animation trigger

gre.animation_trigger(animation_id, data)

Trigger an animation to run. If an animation_id is used to trigger the animation, then it must be the return value from gre.animation_create(). If a name is used to trigger 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.


When an animation is triggered from ANIMATION_NOT_RUNNING, each of the steps duration and offset is resolved. All the steps from the beginning of the animation, until the time specified by progress*duration are computed, this means their to/from/tween values are resolved and the values are applied as appropriate.

When an animation is triggered from ANIMATION_PAUSED, the animation will either seek forwards or backwards, depending on the previous progress and the newly specified progress. When seeking forwards, all the steps that have not yet been processed, up until the specified progress will computed and the values applied. When seeking backwards, the previously computed steps will be directly reversed using the values from when the animation steps were originally computed.

When an animation is triggered without pausing, it will reach ANIMATION_NOT_RUNNING, at which point the animation is partially released from memory and the computed steps can no longer be used. This may have an adverse affect on those animations with relative start values.

Parameters: animation_id The animation to trigger data A table containing the tags and values for the extra arguments to set id The animation id used in the case of multiple animations with the same name context The fully qualified name of an object in the model which will be used as the context for the animation progress: A value from 0.0-1.0, the percentage into the animation to begin. (default is 0) pause: A boolean value to indicate if the animation should be paused immediately after seeking to the value specified by progress, (default is false) reverse: A boolean value to indicate that the animation should run in reverse. (default is false) cleanup: A boolean value to indicate that the running instance of an animation should be removed from memory upon completion. Specifying false will enable a complex animation to be triggered in reverse after completion. (default is true) 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)


--Example of using gre.animation_trigger passing animation names.
function cb_toggle_cur_5day()
    if cur_5day_toggle == false then

--Example of using gre.animation_trigger with context.
function cb_toggle_cur_5day()
    local data = {}

    data["context"] = "Layer1.mycontrol"
    gre.animation_trigger("show_5day", data)
Was this article helpful?
0 out of 0 found this helpful