In Spine, you cannot directly set a condition within one animation to mix a specific part of another animation in the editor. However, you can achieve this effect programmatically at runtime. Here’s how you can do it:
- Create Separate Animations: Create one animation for the whole body movement and another for the facial expressions.
- Use AnimationState: At runtime, use the
AnimationState
to apply both animations. You can set the facial expression animation to play on a separate track and control its timing and mixing.
For example, in your game code, you can apply the body animation and then mix in the facial expression animation at the desired time:
// Apply the body animation
skeletonAnimation.state.SetAnimation(0, "bodyAnimation", true);
// Apply the facial expression animation on a different track
TrackEntry facialExpressionEntry = skeletonAnimation.state.SetAnimation(1, "facialExpressionAnimation", true);
facialExpressionEntry.trackTime = 3; // Start the facial expression animation at 3 seconds
This way, you can control the mixing of animations dynamically, ensuring that the facial expression animation starts at the 3-second mark of the body animation.