Animations are used to change presentations or other characteristics of a frame or other region over time. The Animation object will take over the work of calling code over time, or when it is done, and tracks how close the animation is to completion.
The Animation type doesn't create any visual effects by itself, but it does provide an OnUpdate handler that you can use to support specialized time-sensitive behaviors that aren't provided by the transformations descended from Animations. In addition to tracking the passage of time through an elapsed argument, you can query the animation's progress as a 0-1 fraction to determine how you should set your behavior.
You can also change how the elapsed time corresponds to the progress by changing the smoothing, which creates acceleration or deceleration, or by adding a delay to the beginning or end of the animation.
You can also use an Animation as a timer, by setting the Animation's OnFinished script to trigger a callback and setting the duration to the desired time.
Defined Methods
- Animation:IsForbidden() - This function is not yet documented
- paused = Animation:IsPaused() - Returns whether the animation is currently paused
- playing = Animation:IsPlaying() - Returns whether the animation is currently playing
- stopped = Animation:IsStopped() - Returns whether the animation is currently stopped
- Animation:Pause() - Pauses the animation
- Animation:Play() - Plays the animation
- Animation:SetChildKey(key) - Sets the animation to manipulate a particular child member of its host frame
- Animation:SetDuration(duration) - Sets the time for the animation to progress from start to finish
- Animation:SetEndDelay(delay) - Sets the amount of time for the animation to delay after finishing
- Animation:SetOrder(order) - Sets the order for the animation to play within its parent group
- Animation:SetParent(animGroup) or Animation:SetParent("animGroupName") - Sets the parent for the animation
- Animation:SetSmoothProgress() - This function is not yet documented
- Animation:SetSmoothing("smoothType") - Sets the smoothing type for the animation
- Animation:SetStartDelay(delay) - Sets the amount of time for the animation to delay before its progress begins
- Animation:SetTarget(region) - Sets the region affected by this animation
- Animation:SetTargetKey(key) - Sets the animation to manipulate a particular child member of its target
- Animation:Stop() - Stops the animation
Inherited Methods
- name = Animation:GetName() - Returns the widget object's name
- type = Animation:GetObjectType() - Returns the object's widget type
- parent = Animation:GetParent() - Returns the object's parent object
- handler = Animation:GetScript("scriptType") - Returns the widget's handler function for a script
- hasScript = Animation:HasScript("scriptType") - Returns whether the widget supports a script handler
- Animation:HookScript("scriptType", handler) - Securely hooks a script handler
- isType = Animation:IsObjectType("type") - Returns whether the object belongs to a given widget type
- Animation:SetScript("scriptType", handler) - Sets the widget's handler function for a script
Script Handlers
- OnFinished(self, requested) - Run when the animation (or animation group) finishes animating
- OnLoad(self) - Run when the frame is created
- OnPause(self) - Run when the animation (or animation group) is paused
- OnPlay(self) - Run when the animation (or animation group) begins to play
- OnStop(self, requested) - Run when the animation (or animation group) is stopped
- OnUpdate(self, elapsed) - Run each time the screen is drawn by the game engine