Is it a single animation or do you need to play back multiple animations concurrently? For the single animation case applying the timelines should be easy enough. Just call spAnimation_apply. Pseudo code:
float animationTime = ... whatever point in time in the animation you want to display ...
spSkeleton* skeleton = ...
spAnimation* swingAnimation = ...
spAnimation_apply(swingAnimation, skeleton, animationTime, animationTime, false, nullptr, 0, 1, false, false);
Let's go through the arguments passed to spAnimation_apply real quick:
-
swingAnimation and skeleton are self-explanatory.
-
we pass animationTime for the lastTime parameter. This parameter is used mostly for events. If you need those, pass the animationTime value from the previous frame in here.
-
we pass animationTime for the time parameter. That's the point in time in the animation we want to set the skeleton to.
-
we pass false for the loop parameter. We simply set the skeleton to the pose of the animation at the specified time, no looping required.
-
we pass nullptr for the events parameter, and 0 for the eventsCount parameter. If you need events, pass in whatever is needed.
-
we pass 1 for the alpha parameter. If we passed something < 1 then we'd mix between the current skeleton pose and the pose at that point in time in the animation. Since we want only the animation pose, we pass 1
-
we pass false for the setupPose parameter. This parameter just dictates whether to mix with the setup pose or the current skeleton pose if alpha is < 1. In this case it doesn't matter what we pass, as alpha is 1 (use only timeline).
-
we pass false for the mixingOut parameter. This parameter is used by a few timelines to know whether we mixing towards the current/setup pose, or away from it. We do neither, so we pass false.