apply method

void apply(
  1. Skeleton skeleton,
  2. double lastTime,
  3. double time,
  4. bool loop,
  5. ArrayEvent? events,
  6. double alpha,
  7. MixFrom from,
  8. bool add,
  9. bool out,
  10. bool appliedPose,
)

Applies the animation's timelines to the specified skeleton.

See Timeline::apply() and Applying Animations in the Spine Runtimes Guide.

skeleton The skeleton the animation is applied to. This provides access to the bones, slots, and other skeleton components the timelines may change. lastTime The last time in seconds this animation was applied. Some timelines trigger only at discrete times, in which case all keys are triggered between lastTime (exclusive) and time (inclusive). Pass -1 the first time an animation is applied to ensure frame 0 is triggered. time The time in seconds the skeleton is being posed for. Timelines find the frame before and after this time and interpolate between the frame values. loop True if time beyond the animation duration repeats the animation, else the last frame is used. events If any events are fired, they are added to this list. Can be NULL to ignore fired events or if no timelines fire events. alpha 0 applies setup or current values (depending on from), 1 uses timeline values, and intermediate values interpolate between them. Adjusting alpha over time can mix an animation in or out. from If true, alpha transitions between setup and timeline values, setup values are used before the first frame (current values are not used). If false, alpha transitions between current and timeline values, no change is made before the first frame. add If true, for timelines that support it, their values are added to the setup or current values (depending on from). out True when the animation is mixing out, else it is mixing in. Used by timelines that perform instant transitions. appliedPose True to modify getAppliedPose(), else the unconstrained pose is modified.

Implementation

void apply(Skeleton skeleton, double lastTime, double time, bool loop, ArrayEvent? events, double alpha, MixFrom from,
    bool add, bool out, bool appliedPose) {
  SpineBindings.bindings.spine_animation_apply(_ptr, skeleton.nativePtr.cast(), lastTime, time, loop,
      events?.nativePtr.cast() ?? Pointer.fromAddress(0), alpha, from.value, add, out, appliedPose);
}