Package | dragonBones.animation |
Class | public final class Animation |
Inheritance | Animation Object |
See also
Property | Defined By | ||
---|---|---|---|
animationData : AnimationData
The AnimationData assiociated with this Animation instance. | Animation | ||
currentTime : Number [read-only]
Get the current playhead time in seconds. | Animation | ||
isComplete : Boolean [read-only]
Indicates whether the animation has completed or not. | Animation | ||
isPause : Boolean [read-only]
Indicates whether the animation is paused or not. | Animation | ||
isPlaying : Boolean [read-only]
Indicates whether the animation is playing or not. | Animation | ||
movementID : String [read-only]
The name ID of the current MovementData. | Animation | ||
movementList : Vector.<String> [read-only]
An vector containing all MovementData names the animation can play. | Animation | ||
timeScale : Number
The amount by which passed time should be scaled. | Animation | ||
totalTime : Number [read-only]
Get the total elapsed time in second. | Animation | ||
tweenEnabled : Boolean = true
Whether animation tweening is enabled or not. | Animation |
Method | Defined By | ||
---|---|---|---|
Creates a new Animation instance and attaches it to the passed Arnature. | Animation | ||
dispose():void
Qualifies all resources used by this Animation instance for garbage collection. | Animation | ||
gotoAndPlay(movementID:String, tweenTime:Number = -1, duration:Number = -1, loop:* = null):void
Move the playhead to that MovementData id
| Animation | ||
play():void
Play the animation from the current position. | Animation | ||
stop():void
Stop the playhead. | Animation |
animationData | property |
animationData:AnimationData
The AnimationData assiociated with this Animation instance.
public function get animationData():AnimationData
public function set animationData(value:AnimationData):void
See also
currentTime | property |
currentTime:Number
[read-only] Get the current playhead time in seconds.
public function get currentTime():Number
isComplete | property |
isComplete:Boolean
[read-only] Indicates whether the animation has completed or not.
public function get isComplete():Boolean
isPause | property |
isPause:Boolean
[read-only] Indicates whether the animation is paused or not.
public function get isPause():Boolean
isPlaying | property |
isPlaying:Boolean
[read-only] Indicates whether the animation is playing or not.
public function get isPlaying():Boolean
movementID | property |
movementID:String
[read-only] The name ID of the current MovementData.
public function get movementID():String
See also
movementList | property |
movementList:Vector.<String>
[read-only] An vector containing all MovementData names the animation can play.
public function get movementList():Vector.<String>
See also
timeScale | property |
timeScale:Number
The amount by which passed time should be scaled. Used to slow down or speed up animations. Defaults to 1.
public function get timeScale():Number
public function set timeScale(value:Number):void
totalTime | property |
totalTime:Number
[read-only] Get the total elapsed time in second.
public function get totalTime():Number
tweenEnabled | property |
public var tweenEnabled:Boolean = true
Whether animation tweening is enabled or not.
Animation | () | Constructor |
public function Animation(armature:Armature)
Creates a new Animation instance and attaches it to the passed Arnature.
Parametersarmature:Armature — Armature to attach this Animation instance to.
|
dispose | () | method |
public function dispose():void
Qualifies all resources used by this Animation instance for garbage collection.
gotoAndPlay | () | method |
public function gotoAndPlay(movementID:String, tweenTime:Number = -1, duration:Number = -1, loop:* = null):void
Move the playhead to that MovementData id
Parameters
movementID:String — id of the MovementData to play.
| |
tweenTime:Number (default = -1 ) — tween time to apply (> 0)
| |
duration:Number (default = -1 ) — duration in seconds of that MovementData.
| |
loop:* (default = null ) — that MovementData should loop or play only once (true/false).
|
See also
play | () | method |
public function play():void
Play the animation from the current position.
stop | () | method |
public function stop():void
Stop the playhead.
Download the example files here:
package { import dragonBones.Armature; import dragonBones.factorys.BaseFactory; import flash.display.Sprite; import flash.events.Event; public class DragonAnimation extends Sprite { [Embed(source = "Dragon1.swf", mimeType = "application/octet-stream")] private static const ResourcesData:Class; private var factory:BaseFactory; private var armature:Armature; public function DragonAnimation() { factory = new BaseFactory(); factory.addEventListener(Event.COMPLETE, handleParseData); factory.parseData(new ResourcesData(), 'Dragon'); } private function handleParseData(e:Event):void { armature = factory.buildArmature('Dragon'); addChild(armature.display as Sprite); armature.animation.play(); addEventListener(Event.ENTER_FRAME, updateAnimation); } private function updateAnimation(e:Event):void { armature.advanceTime(1 / stage.frameRate); } } }