Jump to content
GreenSock

Timeline

.iteration()

.iteration( value:Number ) : *

Gets or sets the iteration (the current repeat) of timelines.

Parameters

value: Number

The repeat to jump to.

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 iteration (the current repeat) of timelines. For example, if repeat is 4, and the playhead is currently on its third repeat, .iteration() will return 3.

Including a number will cause the tween to jump to iteration number given. For example, if the repeat is 4, and the playhead is currently on its third repeat, .iteration(2) will make the timeline jump back to the second iteration.

  1. var progress = myTimeline.iteration(); //gets current iteration
  2. myTimeline.iteration( 2 ); //sets iteration the second iteration
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.
×