Frame Time  (Animation Script)

Frame time can be obtained in an animation script using GetElaspedTime function and FRAMETIME variable.

FrameTime Variable Type

3 component vector
Local variable


Members
FrameCount, Seconds, Minutes

Operators
( . ) Invoke function or select .FrameCount/.Seconds/.Minutes component


Declaration
At beginning of script, one or more per line


FRAMETIME FrameTime
FRAMETIME FrameTime1, FrameTime2


Notations
FRAMETIME - Declared FRAMETIME variable
Functions Description and parameter type variations
GetElaspedTime Gets frame time from start of animation

GetElaspedTime(FRAMETIME FrameTime)
   FrameTime.FrameCount  = Count of frames that have been rendered for all animations, starts at 0
   FrameTime.Seconds = Elapsed time in seconds all animations have been running, starts at 0
   FrameTime.Minutes = Elapsed time in minutes all animations have been running, starts at 0

FRAMETIME Variable Functions

Any VERTEX functions may be used with FRAMETIME variable using ( . ) operator and function name, refer to Vertex Variables.


Examples

Named Objects in example, Cylinder, Rectangle
FRAMETIME FrameTime
VERTEX SecondIntervals

GetElaspedTime(FrameTime)
//If more than 30 seconds have elapsed start rotating named object 'Cylinder' for 90 frames
if(FrameTime.Seconds > 30)
{
    Repeat(90)
    {
        Cylinder.Rotate(0, 1, 0)
        Wait()
    }
}

//Calculate second intervals
SecondIntervals.Set(FrameTime.Seconds, FrameTime.Seconds, FrameTime.Seconds)
//1/10th, 1/100th, Milliseconds
SecondIntervals.Mulitply(0.1, 0.01, 0.001)

//When FrameCount gets to 500 translate named object 'Rectangle' along Y axis and wait for 1 frame
if(FrameTime.FrameCount >= 500)
{
   Rectangle.Translate(0, 40, 0);
}