skeleton_animation_mix(animfrom, animto, duration);

参数 描述
animfrom The name (a string) of the first animation set to interpolate from.
animto The name (a string) of the second animation set to interpolate to.
duration The duration of the interpolation (from 0 to 1)




You can switch animation sets easily using the skeleton_animation_set function, but this may cause a skip or stutter as one animation is swapped for another. To prevent this, you can set the mix value between two animation sets and the sprite will interpolate between them. normally you would want to do this in the Create Event of the instance with the skeletal animation as it only needs set once, and GameMaker Studio 2 will interpolate all further changes to the sprite using the animation sets in that instance. Note that the duration value is from 0 to 1, where a value of 0.5 would have a "half and half" interpolation from one set to the other.

重要!该函数在试用版(Trial License)产品中可用。


skeleton_animation_mix("walk", "jump", 0.2);
skeleton_animation_mix("jump", "walk", 0.4);

The above code would go in the Create Event of an instance with a skeletal animation sprite and sets the animation mix durations for interpolating between the two animations sets "walk" and "jump".