Garry's Mod Wiki

Garry's Mod Wiki

  table or nil Entity:GetAnimInfo( number animIndex )

Description

Returns a table containing the number of frames, flags, name, and FPS of an entity's animation ID.

Animation ID is not the same as sequence ID. See Entity:GetAnimCount

Arguments

1 number animIndex
The animation ID to look up, starting at 0.

Returns

1 table or nil
Information about the animation, or nil if the index is out of bounds.

A table with the following keys:

  • string label - Animation name
  • number fps - How many frames per second the animation should be played at
  • number flags - STUDIO_ flags, such as looping
  • number numframes - Number of frames the animation has

Example

A function that finds an entity sequence's corresponding animation and returns the animation info.

function GetAnimInfoSequence( ent, seq ) if( !IsValid( ent ) ) then return nil end local seqname = ent:GetSequenceName( seq ) if( seqname == "Unknown" ) then return nil end for i=0, ent:GetAnimCount() do local info = ent:GetAnimInfo(i) if ( string.find( info.label, "@" .. seqname, 0, true ) or string.find( info.label, "a_" .. seqname, 0, true ) ) then return info end end return nil end

This site is a community mirror of the official Garry's Mod wiki.. This site is not maintained by Facepunch Studios.

Page content is automatically updated four times a day. Edits and history are not available.

Last Parsed: Loading...