animationLength()
Purpose
Find the length of a 3D animation
Description
Some 3D models contain animation sequences. This finds the length of the specified animation sequence
Syntax
length = animationLength( object, animation )
Arguments
length length of animation in seconds
object handle of the animated 3D object
animation index of the animation
Example
cb = loadModel( "Kat Deak/Colin" )
pointLight( { 0.5, 1.3, 2 }, white, 4 )
setAmbientLight( { 0.5, 0.5, 0.5 } )
colin = placeObject( cb, { 0, 0, 0 }, { 1, 1, 1 } )
setCamera( { 0, 10, 10 }, { 0, 5, 0 } )
animID = 7 // the robot
animLength = animationLength( colin, animID )
animFrame = 0
loop
clear()
animFrame = animFrame + 1/60
if animFrame >= animLength then
animframe = 0
endIf
updateAnimation( colin, animID, animFrame )
drawObjects()
printAt( 0, 0, "length: ", animLength, " frame: ", animFrame )
update()
repeat
Associated Commands