Time Values

The Time class implements animation time in MAXScript. Time values reflect the properties of animation time in 3ds Max. Resolution is in ticks, with 4800 ticks per second. You can work with time as ticks, frames, h.m.s, or normalized time.

You can intermix numbers and time values in time computations defined below. The rule is that numbers are always interpreted as frame counts, with floating point numbers specifying fractional frames. The numbers are always converted to tick-based time values internally and so have an ultimate resolution of 4800 ticks per second.

You can do time arithmetic and comparisons using numbers as well as time values and convert between time and (frame) numbers using the as operator. See also Time Literals.

Literals

[-]{<decimal_number>[m | s | f | t]}+

minutes/sec/frames/ticks

[-]{<digit>}:{<digit>}[.{<digit>}]

SMPTE mins:secs.frame

[-]<decimal_number>n

Active segment normalized time

Example Literals

2.5s -- 2.5 seconds

1m15s -- 1 minute 15 seconds

2m30s5f2t -- 2 minutes 30 seconds 5 frames 2 ticks

125f -- 125 frames

17.25f -- 17.25 frames

1f20t -- 1 frame 20 ticks

2:10.0 -- 2 minutes 10 seconds 0 frames (SMPTE)

0:0.29 -- 29 frames (SMPTE)

Constructor

normTime <float>

Time from normal fraction

Properties

<time>.ticks

Time as ticks

<time>.frame

Time as frames

<time>.normalized

Time as normalized fraction of active segment

Operators

<time> + <time>

<time> - <time>

- <time>

 

<time> * <number>

<time> / <number>

Scale time

<time> == <time>

<time> != <time>

<time> > <time>

<time> >= <time>

<time> < <time>

<time> <= <time>

<time> as <class>

You can coerce a time to an Integer or Float number - you get the time in ticks:

For Example:

sliderTime = 35

35

currentTime

35f

currentTime as integer

5600

currentTime as float

5600.0

(currentTime as integer)/TicksPerFrame

35

(currentTime as float)/TicksPerFrame

35.0

Note:

To coerce a Time Value to Frames integer, use the .frame property documented above!

Methods

random <time> <time>

 

abs <time>

 

Examples:

sliderTime = 30

t2 = n as time

if currentTime == 45 then ...

Some of the examples above refer to system global variables. See 3ds Max System Globals for more details.