Animation Functions (Global) - Grisgram/gml-raptor GitHub Wiki
These functions will help you organize your Animations
and provide some shortcut- and convenience functions for common tasks.
/// @function animation_clear_pool()
/// @description Instantly removes ALL animations from the global ANIMATIONS pool.
/// @function animation_get_all(owner = self)
/// @description Get all registered animations for the specified owner from the global ANIMATIONS pool.
/// @param {instance} owner The owner whose animations you want to retrieve.
/// @function animation_abort_all(owner = self, _run_finished_triggers = true)
/// @description Remove all registered animations for the specified owner from the global ANIMATIONS pool.
/// @param {instance} owner The owner that will have its animations removed.
/// @function animation_abort(owner, name, _run_finished_triggers = true)
/// @description Aborts one specific named animation of a specified owner.
/// NOTE: If multiple animations with the same name exist,
/// only the first one found will be aborted!
/// @returns {bool} True, if an animation has been aborted, otherwise false.
/// @function animation_finish_all(owner = self)
/// @description Finish all registered animations for the specified owner.
/// NOTE: Set the owner to <undefined> to finish ALL existing animations!
/// @function animation_finish(owner, name)
/// @description Finishes one specific named animation of a specified owner.
/// NOTE: If multiple animations with the same name exist,
/// only the first one found will be finished!
/// @returns {bool} True, if an animation has been finished, otherwise false.
/// @function animation_pause_all(owner = self)
/// @description Set all registered animations for the specified owner to paused state.
/// NOTE: Set the owner to <undefined> to pause ALL existing animations!
/// This bulk function is very handy if you have a "pause/resume" feature in your
/// game and you want to "freeze" the scene.
/// @function animation_resume_all(owner = self)
/// @description Set all registered animations for the specified owner to running state.
/// NOTE: Set the owner to <undefined> to resume ALL existing animations!
/// This bulk function is very handy if you have a "pause/resume" feature in your
/// game and you want to "unfreeze" the scene.
/// @function is_in_animation(owner = self, name = undefined)
/// @description Returns true, if there's at least one animation for the specified owner
/// currently in the global ANIMATIONS pool.
/// If the name is also specified, true is only returned, if the names match.
/// This is useful if you need to know, whether an object is currently running
/// one specific animation.
/// @param {instance} owner The owner to check.
/// @param {string} name The name of the animation to check.
/// @returns {bool} true, if at least one animation for the specified owner is active
/// @function animation_run(
/// _obj_owner, _delay, _duration, _animcurve, _repeats = 1, _finished_state = undefined)
/// @description Convenience constructor wrapper for when you don't need to keep your own pointer
/// @param {instance} _obj_owner The object to be animated
/// @param {int} _delay How many frames to wait until animation starts
/// @param {int} _duration Running time of (one loop) of the animation
/// @param {AnimCurve} _animcurve The AnimCurve providing the animated values
/// @param {int} _repeats Number of loops to perform. Default = 1, set to -1 for infinite repeats.
/// @param {string} _finished_state If the owner is stateful (or owns a StateMachine named "states"),
/// you can supply the name of a state here to set when this animation
/// finishes (A finished_trigger will be added for you).
/// @returns {Animation}
/// @function animation_run_ex(
/// _obj_owner, _delay, _duration, _animcurve, _repeats = 1, _finished_state = undefined)
/// @description Runs an animation EXCLUSIVE (i.e. calls "animation_abort_all()" for the owner first.
/// Convenience constructor wrapper if you don't need to keep your own pointer
/// @param {instance} _obj_owner The object to be animated
/// @param {int} _delay How many frames to wait until animation starts
/// @param {int} _duration Running time of (one loop) of the animation
/// @param {AnimCurve} _animcurve The AnimCurve providing the animated values
/// @param {int} _repeats Number of loops to perform. Default = 1, set to -1 for infinite repeats.
/// @param {string} _finished_state If the owner is stateful (or owns a StateMachine named "states"),
/// you can supply the name of a state here to set when this animation
/// finishes (A finished_trigger will be added for you).
/// @returns {Animation}
/// @function animate_sprite(
/// _sprite, _layer_name_or_depth, _x, _y, _delay, _duration, _animcurve, _repeats = 1,
/// _data = {})
/// @description Animate a sprite directly, without an object.
/// Similar to animation run, it even returns an animation, but you don't need an object
/// to animate, instead, a sprite_index is enough and a pooled instance of __sprite_anim_runner
/// will be used to run the animation. It returns to the pool, when the animation is finished.
/// Works even for ANIMATION CHAINS! That's why this function returns the created animation and
/// not the pooled runner object. You can obtain the pooled runner object from the .owner
/// property of the animation returned.
/// @param {instance} _sprite The sprite_index to be animated
/// @param {int} _delay How many frames to wait until animation starts
/// @param {int} _duration Running time of (one loop) of the animation
/// @param {AnimCurve} _animcurve The AnimCurve providing the animated values
/// @param {int} _repeats Number of loops to perform. Default = 1, set to -1 for infinite repeats.
/// @returns {Animation}
Continue in abort() vs finish().