skeleton_animation_get_duration


Syntax:

skeleton_animation_get_duration(animname);

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


Returns:

Real


Description

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! This function is not available with the Trial Licence of the product.


Example1:

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;
draw_self();

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

Example2:

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.