An AnimationGroup is how various animations are actually applied to a region; this is how different behaviors can be run in sequence or in parallel with each other, automatically. When you pause an AnimationGroup, it tracks which of its child animations were playing and how far advanced they were, and resumes them from that point.
An Animation in a group has an order from 1 to 100, which determines when it plays; once all animations with order 1 have completed, including any delays, the AnimationGroup starts all animations with order 2.
An AnimationGroup can also be set to loop, either repeating from the beginning or playing backward back to the beginning. An AnimationGroup has an OnLoop handler that allows you to call your own code back whenever a loop completes. The :Finish() method stops the animation after the current loop has completed, rather than immediately.
Defined Methods
- animation = AnimationGroup:CreateAnimation("animationType" [, "name" [, "inheritsFrom"]]) - Creates an Animation as a child of this group
- AnimationGroup:Finish() - Causes animations within the group to complete and stop
- ... = AnimationGroup:GetAnimations() - Returns a list of animations belonging to the group
- duration = AnimationGroup:GetDuration() - Returns the duration of a single loop cycle for the group, as determined by its child animations
- x, y = AnimationGroup:GetInitialOffset() - Returns the starting static translation for the animated region
- loopState = AnimationGroup:GetLoopState() - Returns the current loop state of the group
- loopType = AnimationGroup:GetLooping() - Returns the looping behavior of the group
- maxOrder = AnimationGroup:GetMaxOrder() - Returns the highest order amongst the animations in the group
- progress = AnimationGroup:GetProgress() - Returns the current state of the animation group's progress
- done = AnimationGroup:IsDone() - Returns whether the group has finished playing
- paused = AnimationGroup:IsPaused() - Returns whether the group is paused
- isPending = AnimationGroup:IsPendingFinish() - Returns whether or not the animation group is pending finish
- playing = AnimationGroup:IsPlaying() - Returns whether the group is playing
- AnimationGroup:Pause() - Pauses animation of the group
- AnimationGroup:Play() - Starts animating the group
- AnimationGroup:SetInitialOffset(x, y) - Sets a static translation for the animated region
- AnimationGroup:SetLooping("loopType") - Sets the looping behavior of the group
- AnimationGroup:Stop() - Stops animation of the group
Inherited Methods
- name = AnimationGroup:GetName() - Returns the widget object's name
- type = AnimationGroup:GetObjectType() - Returns the object's widget type
- parent = AnimationGroup:GetParent() - Returns the object's parent object
- handler = AnimationGroup:GetScript("scriptType") - Returns the widget's handler function for a script
- hasScript = AnimationGroup:HasScript("scriptType") - Returns whether the widget supports a script handler
- AnimationGroup:HookScript("scriptType", handler) - Securely hooks a script handler
- isType = AnimationGroup:IsObjectType("type") - Returns whether the object belongs to a given widget type
- AnimationGroup:SetScript("scriptType", handler) - Sets the widget's handler function for a script
Script Handlers
- OnEvent(self, "event", ...) - Run whenever an [[docs/events|event]] fires for which the frame is registered
- OnFinished(self, requested) - Run when the animation (or animation group) finishes animating
- OnLoad(self) - Run when the frame is created
- OnLoop(self, "loopState") - Run when the animation group's loop state changes
- 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