如题,MixSettings在设置Default Mix Duration 为0 的前提下,想要设置其他动画对某一动画进行0.2s混合,或者某一个动画对其他所有动画进行混合
这样设置应该不起作用吧
SkeletonData的MixSettings,Custom Mix设置多对1,一对多
fengmin Yes, it will not work if one of them is set to <None>. To achieve what you want, specify the mix duration when you set or add that animation to the AnimationState track. To specify the mix duration of a particular animation, use the TrackEntry object. For example, it can be written like this:
TrackEntry entry = state.setAnimation(0, "c00000", true);
entry.mixDuration = 0.2;
This way there will be 0.2 seconds of mix before the transition to c00000
, no matter what the previous animation playing on track 0 was. General information about mixes is explained in the Spine runtimes guide:
https://esotericsoftware.com/spine-applying-animations-zh#%E6%B7%B7%E5%90%88%E6%97%B6%E9%97%B4
- Editado
fengmin Unfortunately, that doesn't make much sense, because what the custom mix is setting up is the mix that AnimationStateData
stores. See the "数据对象" and "实例对象" sections of the Runtime Guide for the difference between AnimationStateData
and AnimationState
:
https://zh.esotericsoftware.com/spine-runtime-architecture#%E6%95%B0%E6%8D%AE%E5%AF%B9%E8%B1%A1
The animation name and number of seconds specified in the Custom Mix Duration
section are actually used to specify the mix duration in the AnimationStateData setMix()
method, and the mix durations to be applied when AnimationState animations are changed. As the setMix()
method requires two animations and durations to be set for it to work correctly, it is not possible to set a mix duration with only one of the specified animations.
If one of the animations is not specified, it would be possible to find all the other animations and set a mix duration for all of them, but it would be more efficient to specify something like "the mix duration is this if this animation is specified".