mirror of
https://github.com/EsotericSoftware/spine-runtimes.git
synced 2025-12-20 17:26:01 +08:00
[as3] Fixed DeformTimeline, see #1016.
This commit is contained in:
parent
adc01ab1e4
commit
f31d98506c
Binary file not shown.
@ -35,8 +35,7 @@ package spine.animation {
|
||||
import spine.Skeleton;
|
||||
import spine.Slot;
|
||||
|
||||
public class DeformTimeline extends CurveTimeline {
|
||||
private static var zeros : Vector.<Number> = new Vector.<Number>(64);
|
||||
public class DeformTimeline extends CurveTimeline {
|
||||
public var slotIndex : int;
|
||||
public var frames : Vector.<Number>;
|
||||
public var frameVertices : Vector.<Vector.<Number>>;
|
||||
@ -66,10 +65,11 @@ package spine.animation {
|
||||
if (!(slotAttachment is VertexAttachment) || !(VertexAttachment(slotAttachment)).applyDeform(attachment)) return;
|
||||
|
||||
var verticesArray : Vector.<Number> = slot.attachmentVertices;
|
||||
if (verticesArray.length == 0) alpha = 1;
|
||||
|
||||
var frameVertices : Vector.<Vector.<Number>> = this.frameVertices;
|
||||
var vertexCount : int = frameVertices[0].length;
|
||||
verticesArray.length = vertexCount;
|
||||
var vertices : Vector.<Number> = verticesArray;
|
||||
var vertexCount : int = frameVertices[0].length;
|
||||
var vertices : Vector.<Number>;
|
||||
|
||||
var frames : Vector.<Number> = this.frames;
|
||||
var i : int;
|
||||
@ -77,20 +77,15 @@ package spine.animation {
|
||||
vertexAttachment = VertexAttachment(slotAttachment);
|
||||
switch (pose) {
|
||||
case MixPose.setup:
|
||||
var zeroVertices : Vector.<Number>;
|
||||
if (vertexAttachment.bones == null) {
|
||||
// Unweighted vertex positions (setup pose).
|
||||
zeroVertices = vertexAttachment.vertices;
|
||||
} else {
|
||||
// Weighted deform offsets (zeros).
|
||||
zeroVertices = zeros;
|
||||
if (zeroVertices.length < vertexCount) zeros = zeroVertices = new Vector.<Number>(vertexCount);
|
||||
}
|
||||
for (i = 0; i < vertexCount; i++)
|
||||
vertices[i] = zeroVertices[i];
|
||||
verticesArray.length = 0;
|
||||
return;
|
||||
case MixPose.current:
|
||||
if (alpha == 1) break;
|
||||
if (alpha == 1) {
|
||||
verticesArray.length = 0;
|
||||
return;
|
||||
}
|
||||
verticesArray.length = vertexCount;
|
||||
vertices = verticesArray;
|
||||
if (vertexAttachment.bones == null) {
|
||||
// Unweighted vertex positions.
|
||||
setupVertices = vertexAttachment.vertices;
|
||||
@ -106,6 +101,8 @@ package spine.animation {
|
||||
return;
|
||||
}
|
||||
|
||||
verticesArray.length = vertexCount;
|
||||
vertices = verticesArray;
|
||||
var n : int;
|
||||
var setup : Number, prev : Number;
|
||||
if (time >= frames[frames.length - 1]) { // Time is after last frame.
|
||||
|
||||
Binary file not shown.
@ -45,13 +45,13 @@ package spine.examples {
|
||||
import spine.starling.SkeletonAnimation;
|
||||
|
||||
public class CoinExample extends Sprite {
|
||||
[Embed(source = "/coin-pro.json", mimeType = "application/octet-stream")]
|
||||
[Embed(source = "/Divico.json", mimeType = "application/octet-stream")]
|
||||
static public const CoinJson : Class;
|
||||
|
||||
[Embed(source = "/coin.atlas", mimeType = "application/octet-stream")]
|
||||
[Embed(source = "/Divico.atlas", mimeType = "application/octet-stream")]
|
||||
static public const CoinAtlas : Class;
|
||||
|
||||
[Embed(source = "/coin.png")]
|
||||
[Embed(source = "/Divico.png")]
|
||||
static public const CoinAtlasTexture : Class;
|
||||
private var skeleton : SkeletonAnimation;
|
||||
|
||||
@ -68,7 +68,9 @@ package spine.examples {
|
||||
this.y = 600;
|
||||
|
||||
skeleton = new SkeletonAnimation(skeletonData);
|
||||
skeleton.state.setAnimationByName(0, "rotate", true);
|
||||
skeleton.state.data.defaultMix = 2;
|
||||
skeleton.state.setAnimationByName(0, "airattack1", true);
|
||||
skeleton.state.addAnimationByName(0, "idle", true, 3);
|
||||
skeleton.state.timeScale = 0.5;
|
||||
skeleton.state.update(0.25);
|
||||
skeleton.state.apply(skeleton.skeleton);
|
||||
|
||||
@ -38,7 +38,7 @@ package spine.examples {
|
||||
private var _starling : Starling;
|
||||
|
||||
public function Main() {
|
||||
_starling = new Starling(SpineboyExample, stage);
|
||||
_starling = new Starling(CoinExample, stage);
|
||||
_starling.enableErrorChecking = true;
|
||||
_starling.showStats = true;
|
||||
_starling.skipUnchangedFrames = false;
|
||||
|
||||
Binary file not shown.
Loading…
x
Reference in New Issue
Block a user