Tween Progress

  • This represents the virtual playhead position, excluding repeats and repeatDelays.
  • progress()

    progress(value:Number, suppressEvents:Boolean): [Number | self]

    Gets or sets the tween’s progress, represented by a value between 0 and 1, where:

    • 0 → the beginning of the animation

    • 0.5 → halfway complete

    • 1 → fully complete

    Parameters

    • value (Number, default = NaN)

      • If omitted, returns the current progress (getter).

      • If defined, sets the progress to the given value (setter) and returns the tween instance, allowing method chaining.

      • Valid range: 01.

    • suppressEvents (Boolean, default = false)

      • When true, no callbacks or events are triggered while moving the playhead to the new progress position.

      • When false, events and callbacks that fall between the old and new positions will trigger.


    Returns

    • [Number | self]

      • Returns the current progress value if no parameter is provided.

      • Returns the tween instance itself when a new progress value is set (for chaining).


    Details

    The progress() method controls or reports how far along the tween has progressed, ignoring any repeats or repeatDelays.

    If a tween has repeats, progress and totalProgress behave differently:

    • progress: represents progress within a single cycle (resets each repeat).

    • totalProgress: represents progress across all repeats combined.

    For example:

    If a tween has repeat: 1, then at the end of the first playthrough:

    • progress = 1 (cycle complete)

    • totalProgress = 0.5 (halfway through total playback)

    Over the entire animation, progress would go from 0 → 1 twice, while totalProgress would go from 0 → 1 once.


// Get current progress (value between 0 and 1)
var progress = myTween.progress();

// Set progress to 25% complete
myTween.progress(0.25);

// Jump to 50% complete without triggering callbacks
myTween.progress(0.5, true);

// Chain progress control with other methods
myTween.progress(0.5).play();