public void Apply(Skeleton skeleton, float lastTime, float time, ExposedList <Event> firedEvents, float alpha) { float[] frames = this.frames; if (time < frames[0]) { return; // Time is before first frame. } int frameIndex; if (time >= frames[frames.Length - 1]) // Time is after last frame. { frameIndex = frames.Length - 1; } else { frameIndex = Animation.binarySearch(frames, time) - 1; } ExposedList <Slot> drawOrder = skeleton.drawOrder; ExposedList <Slot> slots = skeleton.slots; int[] drawOrderToSetupIndex = drawOrders[frameIndex]; if (drawOrderToSetupIndex == null) { drawOrder.Clear(); for (int i = 0, n = slots.Count; i < n; i++) { drawOrder.Add(slots.Items[i]); } } else { for (int i = 0, n = drawOrderToSetupIndex.Length; i < n; i++) { drawOrder.Items[i] = slots.Items[drawOrderToSetupIndex[i]]; } } }
public void Apply(Skeleton skeleton, float lastTime, float time, List <Event> firedEvents, float alpha) { float[] frames = this.frames; if (time < frames[0]) { return; // Time is before first frame. } int frameIndex; if (time >= frames[frames.Length - 1]) // Time is after last frame. { frameIndex = frames.Length - 1; } else { frameIndex = Animation.binarySearch(frames, time, 1) - 1; } String attachmentName = attachmentNames[frameIndex]; skeleton.slots[slotIndex].Attachment = attachmentName == null ? null : skeleton.GetAttachment(slotIndex, attachmentName); }
public void Apply(Skeleton skeleton, float lastTime, float time, ExposedList <Event> firedEvents, float alpha) { float[] array = this.frames; if (time < array[0]) { if (lastTime > time) { this.Apply(skeleton, lastTime, 2.14748365E+09f, null, 0f); } return; } if (lastTime > time) { lastTime = -1f; } int num = ((time < array[array.Length - 2]) ? Animation.binarySearch(array, time, 2) : array.Length) - 2; if (array[num] < lastTime) { return; } this.SetFlip(skeleton.bones.Items[this.boneIndex], array[num + 1] != 0f); }
override public void Apply(Skeleton skeleton, float lastTime, float time, ExposedList <Event> events, float alpha) { float[] frames = this.frames; if (time < frames[0]) { return; // Time is before first frame. } PathConstraint constraint = skeleton.pathConstraints.Items[pathConstraintIndex]; if (time >= frames[frames.Length - ENTRIES]) // Time is after last frame. { int i = frames.Length; constraint.spacing += (frames[i + PREV_VALUE] - constraint.spacing) * alpha; return; } // Interpolate between the previous frame and the current frame. int frame = Animation.binarySearch(frames, time, ENTRIES); float spacing = frames[frame + PREV_VALUE]; float frameTime = frames[frame]; float percent = GetCurvePercent(frame / ENTRIES - 1, 1 - (time - frameTime) / (frames[frame + PREV_TIME] - frameTime)); constraint.spacing += (spacing + (frames[frame + VALUE] - spacing) * percent - constraint.spacing) * alpha; }
public void Apply(Skeleton skeleton, float lastTime, float time, ExposedList <Event> firedEvents, float alpha) { float[] frames = this.frames; if (time < frames[0]) { if (lastTime > time) { Apply(skeleton, lastTime, int.MaxValue, null, 0); } return; } else if (lastTime > time) // { lastTime = -1; } int frameIndex = (time >= frames[frames.Length - 1] ? frames.Length : Animation.binarySearch(frames, time)) - 1; //if (frames[frameIndex] < lastTime) return; String attachmentName = attachmentNames[frameIndex]; skeleton.slots.Items[slotIndex].Attachment = attachmentName == null ? null : skeleton.GetAttachment(slotIndex, attachmentName); }
override public void Apply(Skeleton skeleton, float lastTime, float time, ExposedList <Event> firedEvents, float alpha) { float[] frames = this.frames; if (time < frames[0]) { return; // Time is before first frame. } TransformConstraint constraint = skeleton.transformConstraints.Items[transformConstraintIndex]; if (time >= frames[frames.Length - 5]) // Time is after last frame. { int i = frames.Length - 1; constraint.rotateMix += (frames[i - 3] - constraint.rotateMix) * alpha; constraint.translateMix += (frames[i - 2] - constraint.translateMix) * alpha; constraint.scaleMix += (frames[i - 1] - constraint.scaleMix) * alpha; constraint.shearMix += (frames[i] - constraint.shearMix) * alpha; return; } // Interpolate between the previous frame and the current frame. int frame = Animation.binarySearch(frames, time, 5); float frameTime = frames[frame]; float percent = 1 - (time - frameTime) / (frames[frame + PREV_TIME] - frameTime); percent = GetCurvePercent(frame / 5 - 1, percent < 0 ? 0 : (percent > 1 ? 1 : percent)); float rotate = frames[frame + PREV_ROTATE_MIX]; float translate = frames[frame + PREV_TRANSLATE_MIX]; float scale = frames[frame + PREV_SCALE_MIX]; float shear = frames[frame + PREV_SHEAR_MIX]; constraint.rotateMix += (rotate + (frames[frame + ROTATE_MIX] - rotate) * percent - constraint.rotateMix) * alpha; constraint.translateMix += (translate + (frames[frame + TRANSLATE_MIX] - translate) * percent - constraint.translateMix) * alpha; constraint.scaleMix += (scale + (frames[frame + SCALE_MIX] - scale) * percent - constraint.scaleMix) * alpha; constraint.shearMix += (shear + (frames[frame + SHEAR_MIX] - shear) * percent - constraint.shearMix) * alpha; }
override public void Apply(Skeleton skeleton, float lastTime, float time, ExposedList <Event> firedEvents, float alpha) { Slot slot = skeleton.slots.Items[slotIndex]; VertexAttachment slotAttachment = slot.attachment as VertexAttachment; if (slotAttachment == null || !slotAttachment.ApplyDeform(attachment)) { return; } float[] frames = this.frames; if (time < frames[0]) { return; // Time is before first frame. } float[][] frameVertices = this.frameVertices; int vertexCount = frameVertices[0].Length; var verticesArray = slot.attachmentVertices; if (verticesArray.Count != vertexCount) { alpha = 1; // Don't mix from uninitialized slot vertices. } // verticesArray.SetSize(vertexCount) // Ensure size and preemptively set count. if (verticesArray.Capacity < vertexCount) { verticesArray.Capacity = vertexCount; } verticesArray.Count = vertexCount; float[] vertices = verticesArray.Items; if (time >= frames[frames.Length - 1]) // Time is after last frame. { float[] lastVertices = frameVertices[frames.Length - 1]; if (alpha < 1) { for (int i = 0; i < vertexCount; i++) { float vertex = vertices[i]; vertices[i] = vertex + (lastVertices[i] - vertex) * alpha; } } else { Array.Copy(lastVertices, 0, vertices, 0, vertexCount); } return; } // Interpolate between the previous frame and the current frame. int frame = Animation.binarySearch(frames, time); float[] prevVertices = frameVertices[frame - 1]; float[] nextVertices = frameVertices[frame]; float frameTime = frames[frame]; float percent = GetCurvePercent(frame - 1, 1 - (time - frameTime) / (frames[frame - 1] - frameTime)); if (alpha < 1) { for (int i = 0; i < vertexCount; i++) { float prev = prevVertices[i]; float vertex = vertices[i]; vertices[i] = vertex + (prev + (nextVertices[i] - prev) * percent - vertex) * alpha; } } else { for (int i = 0; i < vertexCount; i++) { float prev = prevVertices[i]; vertices[i] = prev + (nextVertices[i] - prev) * percent; } } }
override public void Apply(Skeleton skeleton, float lastTime, float time, List <Event> firedEvents, float alpha) { Slot slot = skeleton.slots[slotIndex]; if (slot.attachment != attachment) { return; } float[] frames = this.frames; if (time < frames[0]) { slot.attachmentVerticesCount = 0; return; // Time is before first frame. } float[][] frameVertices = this.frameVertices; int vertexCount = frameVertices[0].Length; float[] vertices = slot.attachmentVertices; if (vertices.Length != vertexCount) { alpha = 1; } if (vertices.Length < vertexCount) { vertices = new float[vertexCount]; slot.attachmentVertices = vertices; } slot.attachmentVerticesCount = vertexCount; if (time >= frames[frames.Length - 1]) // Time is after last frame. { float[] lastVertices = frameVertices[frames.Length - 1]; if (alpha < 1) { for (int i = 0; i < vertexCount; i++) { vertices[i] += (lastVertices[i] - vertices[i]) * alpha; } } else { Array.Copy(lastVertices, 0, vertices, 0, vertexCount); } return; } // Interpolate between the previous frame and the current frame. int frameIndex = Animation.binarySearch(frames, time); float frameTime = frames[frameIndex]; float percent = 1 - (time - frameTime) / (frames[frameIndex - 1] - frameTime); percent = GetCurvePercent(frameIndex - 1, percent < 0 ? 0 : (percent > 1 ? 1 : percent)); float[] prevVertices = frameVertices[frameIndex - 1]; float[] nextVertices = frameVertices[frameIndex]; if (alpha < 1) { for (int i = 0; i < vertexCount; i++) { float prev = prevVertices[i]; vertices[i] += (prev + (nextVertices[i] - prev) * percent - vertices[i]) * alpha; } } else { for (int i = 0; i < vertexCount; i++) { float prev = prevVertices[i]; vertices[i] = prev + (nextVertices[i] - prev) * percent; } } }
public override void Apply(Skeleton skeleton, float lastTime, float time, ExposedList <Event> firedEvents, float alpha) { Slot slot = skeleton.slots.Items[this.slotIndex]; if (slot.attachment != this.attachment) { return; } float[] array = this.frames; if (time < array[0]) { return; } float[][] array2 = this.frameVertices; int num = array2[0].Length; float[] array3 = slot.attachmentVertices; if (array3.Length < num) { array3 = new float[num]; slot.attachmentVertices = array3; } if (array3.Length != num) { alpha = 1f; } slot.attachmentVerticesCount = num; if (time >= array[array.Length - 1]) { float[] array4 = array2[array.Length - 1]; if (alpha < 1f) { for (int i = 0; i < num; i++) { float num2 = array3[i]; array3[i] = num2 + (array4[i] - num2) * alpha; } } else { Array.Copy(array4, 0, array3, 0, num); } return; } int num3 = Animation.binarySearch(array, time); float num4 = array[num3]; float num5 = 1f - (time - num4) / (array[num3 - 1] - num4); num5 = base.GetCurvePercent(num3 - 1, (num5 >= 0f) ? ((num5 <= 1f) ? num5 : 1f) : 0f); float[] array5 = array2[num3 - 1]; float[] array6 = array2[num3]; if (alpha < 1f) { for (int j = 0; j < num; j++) { float num6 = array5[j]; float num7 = array3[j]; array3[j] = num7 + (num6 + (array6[j] - num6) * num5 - num7) * alpha; } } else { for (int k = 0; k < num; k++) { float num8 = array5[k]; array3[k] = num8 + (array6[k] - num8) * num5; } } }
public override void Apply(Skeleton skeleton, float lastTime, float time, ExposedList <Event> firedEvents, float alpha) { Slot slot = skeleton.slots.Items[this.slotIndex]; VertexAttachment vertexAttachment = slot.attachment as VertexAttachment; if (vertexAttachment == null || !vertexAttachment.ApplyDeform(this.attachment)) { return; } float[] array = this.frames; if (time < array[0]) { return; } float[][] array2 = this.frameVertices; int num = array2[0].Length; ExposedList <float> attachmentVertices = slot.attachmentVertices; if (attachmentVertices.Count != num) { alpha = 1f; } if (attachmentVertices.Capacity < num) { attachmentVertices.Capacity = num; } attachmentVertices.Count = num; float[] items = attachmentVertices.Items; if (time >= array[array.Length - 1]) { float[] array3 = array2[array.Length - 1]; if (alpha < 1f) { for (int i = 0; i < num; i++) { float num2 = items[i]; items[i] = num2 + (array3[i] - num2) * alpha; } } else { Array.Copy(array3, 0, items, 0, num); } return; } int num3 = Animation.binarySearch(array, time); float[] array4 = array2[num3 - 1]; float[] array5 = array2[num3]; float num4 = array[num3]; float curvePercent = base.GetCurvePercent(num3 - 1, 1f - (time - num4) / (array[num3 - 1] - num4)); if (alpha < 1f) { for (int j = 0; j < num; j++) { float num5 = array4[j]; float num6 = items[j]; items[j] = num6 + (num5 + (array5[j] - num5) * curvePercent - num6) * alpha; } } else { for (int k = 0; k < num; k++) { float num7 = array4[k]; items[k] = num7 + (array5[k] - num7) * curvePercent; } } }
override public void Apply(Skeleton skeleton, float lastTime, float time, ExposedList <Event> firedEvents, float alpha) { Slot slot = skeleton.slots.Items[slotIndex]; IFfdAttachment ffdAttachment = slot.attachment as IFfdAttachment; if (ffdAttachment == null || !ffdAttachment.ApplyFFD(attachment)) { return; } float[] frames = this.frames; if (time < frames[0]) { return; // Time is before first frame. } float[][] frameVertices = this.frameVertices; int vertexCount = frameVertices[0].Length; float[] vertices = slot.attachmentVertices; if (slot.attachmentVerticesCount != vertexCount) { alpha = 1; // Don't mix from uninitialized slot vertices. } // Ensure capacity if (vertices.Length < vertexCount) { vertices = new float[vertexCount]; slot.attachmentVertices = vertices; } slot.attachmentVerticesCount = vertexCount; if (time >= frames[frames.Length - 1]) // Time is after last frame. { float[] lastVertices = frameVertices[frames.Length - 1]; if (alpha < 1) { for (int i = 0; i < vertexCount; i++) { float vertex = vertices[i]; vertices[i] = vertex + (lastVertices[i] - vertex) * alpha; } } else { Array.Copy(lastVertices, 0, vertices, 0, vertexCount); } return; } // Interpolate between the previous frame and the current frame. int frameIndex = Animation.binarySearch(frames, time); float frameTime = frames[frameIndex]; float percent = 1 - (time - frameTime) / (frames[frameIndex - 1] - frameTime); percent = GetCurvePercent(frameIndex - 1, percent < 0 ? 0 : (percent > 1 ? 1 : percent)); float[] prevVertices = frameVertices[frameIndex - 1]; float[] nextVertices = frameVertices[frameIndex]; if (alpha < 1) { for (int i = 0; i < vertexCount; i++) { float prev = prevVertices[i]; float vertex = vertices[i]; vertices[i] = vertex + (prev + (nextVertices[i] - prev) * percent - vertex) * alpha; } } else { for (int i = 0; i < vertexCount; i++) { float prev = prevVertices[i]; vertices[i] = prev + (nextVertices[i] - prev) * percent; } } }