| Package | dragonBones.objects |
| Class | public class BoneTransform |
| Inheritance | BoneTransform Object |
See also
| Property | Defined 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 | ||
| Method | Defined 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 | ||
| pivotX | property |
public var pivotX:Numberpivot point on the x axis (registration)
| pivotY | property |
public var pivotY:Numberpivot point on the y axis (registration)
| rotation | property |
rotation:NumberThe rotation of that BoneTransform instance.
public function get rotation():Number public function set rotation(value:Number):void| scaleX | property |
public var scaleX:NumberScale on the x axis.
| scaleY | property |
public var scaleY:NumberScale on the y axis.
| skewX | property |
public var skewX:NumberSkew on the x axis.
| skewY | property |
public var skewY:Numberskew on the y axis.
| x | property |
public var x:NumberPosition on the x axis.
| y | property |
public var y:NumberPosition on the y axis.
| z | property |
public var z:NumberZ order.
| BoneTransform | () | Constructor |
public function BoneTransform()Creat a new BoneTransform instance.
| copy | () | method |
public function copy(node:BoneTransform):voidCopy 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):voidSets 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():StringGet a string representing all BoneTransform property values.
ReturnsString — String All property values in a formatted string.
|
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);
}
}
}