Animation

Base class for all TweenLite, TweenMax, TimelineLite, and TimelineMax classes, providing core methods/properties/functionality, but there is no reason to create an instance of this class directly.

Constructor

Animation( duration:Number, vars:Object ) ;

Constructor

Properties

data : *

A place to store any data you want (initially populated with vars.data if it exists).

timeline : SimpleTimeline

[Read-only] Parent timeline.

vars : Object

The vars object passed into the constructor which stores configuration variables like onComplete, onUpdate, etc.

Methods

delay( value:Number ) : *

Gets or sets the animation's initial delay which is the length of time in seconds (or frames for frames-based tweens) before the animation should begin.

duration( value:Number ) : *

Gets or sets the animation's duration, not including any repeats or repeatDelays (which are only available in TweenMax and TimelineMax).

endTime( includeRepeats:Boolean ) : Number

Returns the time at which the animation will finish according to the parent timeline's local time.

eventCallback( type:String, callback:Function, params:Array, scope:* ) : *

Gets or sets an event callback like "onComplete", "onUpdate", "onStart", "onReverseComplete" or "onRepeat" (onRepeat only applies to TweenMax or TimelineMax instances) along with any parameters that should be passed to that callback.

invalidate( ) : *

Flushes any internally-recorded starting/ending values which can be useful if you want to restart an animation without reverting to any previously recorded starting values.

isActive( ) : Boolean

Indicates whether or not the animation is currently active (meaning the virtual playhead is actively moving across this instance's time span and it is not paused, nor are any of its ancestor timelines).

kill( vars:Object, target:Object ) : *

Kills the animation entirely or in part depending on the parameters.

pause( atTime:*, suppressEvents:Boolean ) : *

Pauses the instance, optionally jumping to a specific time.

paused( value:Boolean ) : *

Gets or sets the animation's paused state which indicates whether or not the animation is currently paused.

play( from:*, suppressEvents:Boolean ) : *

Begins playing forward, optionally from a specific time (by default playback begins from wherever the playhead currently is).

progress( value:Number, suppressEvents:Boolean ) : *

Gets or sets the animations's progress which is a value between 0 and 1 indicating the position of the virtual playhead (excluding repeats) where 0 is at the beginning, 0.5 is at the halfway point, and 1 is at the end (complete).

restart( includeDelay:Boolean, suppressEvents:Boolean ) : *

Restarts and begins playing forward from the beginning.

resume( from:*, suppressEvents:Boolean ) : *

Resumes playing without altering direction (forward or reversed), optionally jumping to a specific time first.

reverse( from:*, suppressEvents:Boolean ) : *

Reverses playback so that all aspects of the animation are oriented backwards including, for example, a tween's ease.

reversed( value:Boolean ) : *

Gets or sets the animation's reversed state which indicates whether or not the animation should be played backwards.

seek( time:*, suppressEvents:Boolean ) : *

Jumps to a specific time without affecting whether or not the instance is paused or reversed.

startTime( value:Number ) : *

Gets or sets the time at which the animation begins on its parent timeline (after any delay that was defined).

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.

timeScale( value:Number ) : *

Factor that's used to scale time in the animation where 1 = normal speed (the default), 0.5 = half speed, 2 = double speed, etc.

totalDuration( value:Number ) : *

Gets or sets the animation's total duration including any repeats or repeatDelays (which are only available in TweenMax and TimelineMax).

totalProgress( value:Number, suppressEvents:Boolean ) : *

Gets or sets the animation's total progress which is a value between 0 and 1 indicating the position of the virtual playhead (including repeats) where 0 is at the beginning, 0.5 is at the halfway point, and 1 is at the end (complete).

totalTime( time:Number, suppressEvents:Boolean ) : *

Gets or sets the position of the playhead according to the totalDuration which includes any repeats and repeatDelays (only available in TweenMax and TimelineMax).

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.

Get GSAP

Version: 2.0.1 updated 2018-05-30

Core

    Extras

      Plugins

        By using GreenSock code, you agree to the terms of use.

        For an all-access pass to premium content

        Join Club GreenSock