GetAnimationLength

This function gets the number of frames in an entity's animation sequence.

Syntax

Parameters

Returns

Returns the number of animation frames in he specified animation sequence.

Example

#include "Leadwerks.h"

using namespace Leadwerks;

int main(int argc, const char *argv[])
{
Leadwerks::Window* window = Leadwerks::Window::Create();

Context* context = Context::Create(window);

World* world = World::Create();

Camera* camera = Camera::Create();
camera->SetRotation(35, 0, 0);
camera->Move(0, 0, -3);

Light* light = DirectionalLight::Create();
light->SetRotation(35, 35, 0);

//Load a model
Entity* entity = Model::Load("Models/Characters/Crawler/crawler.mdl");

while (true)
{
if (window->Closed() || window->KeyDown(Key::Escape)) return false;
Leadwerks::Leadwerks::Time::Update();
world->Update();
world->Render();

context->SetBlendMode(Blend::Alpha);
context->DrawText("Animation length: " + String(entity->GetAnimationLength(0)) + " frames", 2, 2);

context->Sync();
}
}