Phaser API Documentation

  Version: 

Member of: Phaser.Tweens.Tween

seek(toPosition, [delta])

Description:

Seeks to a specific point in the Tween.

Note: Be careful when seeking a Tween that repeats or loops forever, or that has an unusually long total duration, as it's possible to hang the browser.

The given position is a value between 0 and 1 which represents how far through the Tween to seek to. A value of 0.5 would seek to half-way through the Tween, where-as a value of zero would seek to the start.

Note that the seek takes the entire duration of the Tween into account, including delays, loops and repeats. For example, a Tween that lasts for 2 seconds, but that loops 3 times, would have a total duration of 6 seconds, so seeking to 0.5 would seek to 3 seconds into the Tween, as that's half-way through its entire duration.

Seeking works by resetting the Tween to its initial values and then iterating through the Tween at delta jumps per step. The longer the Tween, the longer this can take.

Parameters:

name type arguments Default description
toPosition number

A value between 0 and 1 which represents the progress point to seek to.

delta number <optional> 16.6

The size of each step when seeking through the Tween. A higher value completes faster but at a cost of less precision.

Returns:
Description:

This Tween instance.

Since: 3.0.0