gre.animation_trigger

gre.animation_trigger(animation_id, data)
gre.animation_trigger("animation_name")

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.


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

Example:
                    

function create_animation(mapargs)
    local data = {}

    -- slide the x position 400 pixels over 2000 msec 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)
end

--Example of using gre.animation_trigger passing animation names.
function cb_toggle_cur_5day()
    if cur_5day_toggle == false then
        gre.animation_trigger("show_5day")
    else
        gre.animation_trigger("hide_mon_to_fri")
    end
end

--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)
end