To change the animation playback speed in the Spine Web Player, you can use the timeScale
property of the TrackEntry
object. This allows you to control the speed of a particular animation. Here is an example of how you can achieve this:
<script>
new spine.SpinePlayer("player-container", {
jsonUrl: "path/to/your/skeleton.json",
atlasUrl: "path/to/your/atlas.atlas",
animation: "run",
success: function (player) {
// Access the animation state
var animationState = player.animationState;
// Set the animation with a specific time scale
var trackEntry = animationState.setAnimation(0, "run", true);
trackEntry.timeScale = 2.0; // Speed up the animation (2x speed)
},
error: function (player, reason) {
alert(reason);
}
});
</script>
In this example, the timeScale
is set to 2.0
, which means the animation will play at twice the normal speed. You can adjust the timeScale
value to make the animation run faster or slower. For instance, setting timeScale
to 0.5
will make the animation play at half the normal speed.
For more detailed control, you can refer to the Spine Web Player documentation.