apply method
void
apply(
- Skeleton skeleton,
- double lastTime,
- double time,
- List<
Event?> events, - double alpha,
- MixPose pose,
- MixDirection direction
override
Implementation
@override
void apply(Skeleton skeleton, double lastTime, double time,
List<Event?> events, double alpha, MixPose pose, MixDirection direction) {
final Slot slot = skeleton.slots[slotIndex];
if (direction == MixDirection.mixOut && pose == MixPose.setup) {
final String? attachmentName = slot.data.attachmentName;
slot.setAttachment(attachmentName == null
? null
: skeleton.getAttachment(slotIndex, attachmentName));
return;
}
final Float32List frames = this.frames;
if (time < frames[0]) {
if (pose == MixPose.setup) {
final String? attachmentName = slot.data.attachmentName;
slot.setAttachment(attachmentName == null
? null
: skeleton.getAttachment(slotIndex, attachmentName));
}
return;
}
int frameIndex = 0;
if (time >= frames[frames.length - 1]) {
frameIndex = frames.length - 1;
} else {
frameIndex = Animation.binarySearch(frames, time, 1) - 1;
}
final String? attachmentName = attachmentNames[frameIndex];
skeleton.slots[slotIndex].setAttachment(attachmentName == null
? null
: skeleton.getAttachment(slotIndex, attachmentName));
}