Jump to content
GreenSock

Search In
  • More options...
Find results that contain...
Find results in...

Tween

.duration()

.duration( value:Number ) : *

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

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.

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 animation’s duration, not including any repeats or repeatDelays. For example, if a tween has a duration of 2 and a repeat of 3, its totalDuration would be 8 (one standard play plus 3 repeats equals 4 total cycles).

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, like myAnimation.duration(2).delay(0.5).play(1);

  1. var currentDuration = myAnimation.duration(); //gets current duration
  2. myAnimation.duration(2); //sets duration
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.
×