Jump to content
GreenSock

TimelineLite

.time()

.time( value:Number, suppressEvents:Boolean ) : *

Gets or sets the local position of the playhead (essentially the current time), described in seconds (or frames for frames-based animations) which will never be less than 0 or greater than the animation's duration.

Parameters

value: Number

(default = NaN) — Omitting the parameter returns the current value (getter), whereas defining the parameter sets the value (setter) and returns the instance itself for easier chaining. Negative values will be interpreted from the END of the animation.

suppressEvents: Boolean

(default = false) — If true, no events or callbacks will be triggered when the playhead moves to the new position defined in the value parameter.

Returns : *

Omitting the parameter returns the current value (getter), whereas defining the parameter sets the value (setter) and returns the instance itself for easier chaining.

Details

Gets or sets the local position of the playhead (essentially the current time), described in seconds (or frames for frames-based animations) which will never be less than 0 or greater than the animation's duration. For example, if the duration is 10 and you were to watch the time during the course of the animation, you'd see it go from 0 at the beginning to 10 at the end. Setting time to 5 would cause the animation to jump to its midway point (because it's half of the duration).

This method serves as both a getter and setter. Omitting the parameter returns the current value (getter), whereas defining the parameter sets the value (setter) and returns the instance itself for easier chaining.

var currentTime = myAnimation.time(); //gets current time
myAnimation.time(2); //sets time, jumping to new value just like seek().
Copyright 2017, GreenSock. All rights reserved. This work is subject to theterms of useor for Club GreenSock members, the software agreement that was issued with the membership.
×