GetAnimationLength
This function gets the number of frames in an entity's animation sequence.
Syntax
- number GetAnimationLength(number index)
- number GetAnimationLength(string name)
Parameters
- index: the animation sequence to get the length of.
- name: the name of the animation sequence to use, i.e. "walk", "run", "attack", etc.
Returns
Returns the number of animation frames in he specified animation sequence.
Example
--Create a window
window = Window:Create()
context = Context:Create(window)
world = World:Create()
local camera = Camera:Create()
camera:SetRotation(35,0,0)
camera:Move(0,0,-3)
local light = DirectionalLight:Create()
light:SetRotation(35,35,0)
--Load a model
local model = Model:Load("Models/Characters/Crawler/crawler.mdl")
while true do
if window:Closed() or window:KeyHit(Key.Escape) then return false end
Time:Update()
world:Update()
world:Render()
context:SetBlendMode(Blend.Alpha)
context:DrawText("Animation length: "..model:GetAnimationLength(0).." frames",2,2);
context:Sync()
end