Get the time, in seconds, that a given animation set requires to play.



Argument Description
animname The name (a string) of the animation set to use.

Returns: Real


This function will return the time required for the given animation set to run before looping back to the beginning. The return value is in seconds.

IMPORTANT: Spine integration in GameMaker: Studio is a Pro licence feature and will not work in the Free/Standard versions.


time += delta_time / 1000000;
var duration = skeleton_animation_get_duration(skeleton_animation_get());
var frame = floor((image_number * (mTime / duration)) + 0.5) % image_number;
image_index = frame;

The above code will set the image_index to the correct value for the currently assigned skeletal animation sprite.


time += delta_time / 1000000;
var d = skeleton_animation_get_duration("walk");
if time > d time -= d;
draw_skeleton_time(sprite_index, "walk", "skin1", time, x, y, image_xscale, image_yscale, image_angle, c_white);

The above code will draw the given skeletal animation sprite using delta-time to set the frame being drawn.

Back: Skeletal Animations
Next: skeleton_animation_mix
© Copyright YoYo Games Ltd. 2018 All Rights Reserved