GetAnimationLength

Category: Animations
Since engine version: 1.0 OC

Description

Returns the length of the animation with the given name, or nil if there is no such animation. Valid positions (for PlayAnimation and SetAnimationPosition) include values between 0 and the animation length. The returned number corresponds to the animation length (as specified in the modelling tool) in milliseconds.

Syntax

int GetAnimationLength(string animation, int attach_number);

Parameters

animation:
Name of the animation whose length to retrieve.
attach_number:
[opt] If given, refers to the number of the attached mesh to query instead of the object's main mesh.

Remark

See the animation documentation for further explanations of the animation system.

Example

PlayAnimation("Turn", 5, Anim_Linear(0, 0, GetAnimationLength("Turn"), 50, ANIM_Loop), Anim_Const(1000));
Plays a new animation named "Turn" in slot 5 which superimposes other animations in slot 5. One animation cycle lasts 50 frames. After that time the animation restarts from the beginning.
See also: PlayAnimation, SetAnimationPosition
Clonk-Karl, 2010-01