skeleton_animation_get_duration


语法:

skeleton_animation_get_duration(animname);

参数 描述
animname The name (a string) of the animation set to use.


返回:

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.

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


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.