override public void Apply (Skeleton skeleton, float lastTime, float time, ExposedList<Event> firedEvents, float alpha, bool setupPose, bool mixingOut) {
PathConstraint constraint = skeleton.pathConstraints.Items[pathConstraintIndex];
float[] frames = this.frames;
if (time < frames[0]) {
if (setupPose) constraint.spacing = constraint.data.spacing;
return;
}
float spacing;
if (time >= frames[frames.Length - ENTRIES]) // Time is after last frame.
spacing = frames[frames.Length + PREV_VALUE];
else {
// Interpolate between the previous frame and the current frame.
int frame = Animation.BinarySearch(frames, time, ENTRIES);
spacing = frames[frame + PREV_VALUE];
float frameTime = frames[frame];
float percent = GetCurvePercent(frame / ENTRIES - 1,
1 - (time - frameTime) / (frames[frame + PREV_TIME] - frameTime));
spacing += (frames[frame + VALUE] - spacing) * percent;
}
if (setupPose)
constraint.spacing = constraint.data.spacing + (spacing - constraint.data.spacing) * alpha;
else
constraint.spacing += (spacing - constraint.spacing) * alpha;
}
}