PackagedragonBones.objects
Classpublic class BoneTransform
InheritanceBoneTransform Inheritance Object

The BoneTransform class provides transformation properties and methods for Bone instances.

View the examples

See also

dragonBones.Bone
dragonBones.animation.Animation


Public Properties
 PropertyDefined By
  pivotX : Number
pivot point on the x axis (registration)
BoneTransform
  pivotY : Number
pivot point on the y axis (registration)
BoneTransform
  rotation : Number
The rotation of that BoneTransform instance.
BoneTransform
  scaleX : Number
Scale on the x axis.
BoneTransform
  scaleY : Number
Scale on the y axis.
BoneTransform
  skewX : Number
Skew on the x axis.
BoneTransform
  skewY : Number
skew on the y axis.
BoneTransform
  x : Number
Position on the x axis.
BoneTransform
  y : Number
Position on the y axis.
BoneTransform
  z : Number
Z order.
BoneTransform
Public Methods
 MethodDefined By
  
Creat a new BoneTransform instance.
BoneTransform
  
copy(node:BoneTransform):void
Copy all properties from this BoneTransform instance to the passed BoneTransform instance.
BoneTransform
  
setValues(x:Number = 0, y:Number = 0, skewX:Number = 0, skewY:Number = 0, scaleX:Number = 0, scaleY:Number = 0, pivotX:Number = 0, pivotY:Number = 0, z:int = 0):void
Sets all properties at once.
BoneTransform
  
toString():String
Get a string representing all BoneTransform property values.
BoneTransform
Property Detail
pivotXproperty
public var pivotX:Number

pivot point on the x axis (registration)

pivotYproperty 
public var pivotY:Number

pivot point on the y axis (registration)

rotationproperty 
rotation:Number

The rotation of that BoneTransform instance.


Implementation
    public function get rotation():Number
    public function set rotation(value:Number):void
scaleXproperty 
public var scaleX:Number

Scale on the x axis.

scaleYproperty 
public var scaleY:Number

Scale on the y axis.

skewXproperty 
public var skewX:Number

Skew on the x axis.

skewYproperty 
public var skewY:Number

skew on the y axis.

xproperty 
public var x:Number

Position on the x axis.

yproperty 
public var y:Number

Position on the y axis.

zproperty 
public var z:Number

Z order.

Constructor Detail
BoneTransform()Constructor
public function BoneTransform()

Creat a new BoneTransform instance.

Method Detail
copy()method
public function copy(node:BoneTransform):void

Copy all properties from this BoneTransform instance to the passed BoneTransform instance.

Parameters

node:BoneTransform

setValues()method 
public function setValues(x:Number = 0, y:Number = 0, skewX:Number = 0, skewY:Number = 0, scaleX:Number = 0, scaleY:Number = 0, pivotX:Number = 0, pivotY:Number = 0, z:int = 0):void

Sets all properties at once.

Parameters

x:Number (default = 0) — The x position.
 
y:Number (default = 0) — The y position.
 
skewX:Number (default = 0) — The skew value on x axis.
 
skewY:Number (default = 0) — The skew value on y axis.
 
scaleX:Number (default = 0) — The scale on x axis.
 
scaleY:Number (default = 0) — The scale on y axis.
 
pivotX:Number (default = 0) — The pivot value on x axis (registration)
 
pivotY:Number (default = 0) — The pivot valule on y axis (registration)
 
z:int (default = 0) — The z order.

toString()method 
public function toString():String

Get a string representing all BoneTransform property values.

Returns
String — String All property values in a formatted string.
Examples

Download the example files here:

This example gets the BoneTransform of the head bone and adjust the x and y registration by 60 pixels.

    
     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();
                     var bone:Bone = armature.getBone("head");
                     bone.origin.pivotX = 60;//origin BoneTransform
                 bone.origin.pivotY = 60;//origin BoneTransform
                 addEventListener(Event.ENTER_FRAME, updateAnimation);            
             }
             
             private function updateAnimation(e:Event):void 
             {
                 armature.advanceTime(1 / stage.frameRate);
             }        
         }
     }