A Tween that takes control of values and animates them.
Methods
- from(from: any):
Tween
; - to(to: any, duration: number):
Tween
; - modify(force: any, updateTo: boolean):
void
; - setLoop(loop: number):
Tween
; - setRelative(relative: boolean):
Tween
; - setEasing(type: EasingType | string):
Tween
; - setTimescale(scale: number):
Tween
; - setSteps(steps: number):
Tween
; - yoyo(times: number):
Tween
; - reverse():
void
; - toSequence():
Sequence
;
Properties
- elapsed:
number
number of ms. elapsed for this tween (affected by pause & timescale) - duration:
number
duration of this tween in ms. - isRunning:
boolean
- isFinished:
boolean
- isPaused:
boolean
Controls
- start():
Tween
By default new tween are not started. Don’t forget to call .start() - pause():
void
- resume():
void
- skip():
void
- kill():
void
Callbacks
- onStart(cb: () => void):
Tween
- onUpdate(cb: (dt: number, progress: number) => void):
Tween
- onKilled(cb: () => void):
Tween
- onComplete(cb: () => void):
Tween
- onRestart(cb: () => void):
Tween
- toPromise():
Promise<Tween>
: Convert the tween into a promise and let you use async/await API
Easing
The possible easing method usable in Tween.SetEasing(…) are:
linear
,
inQuad
,
outQuad
,
inOutQuad
,
inCubic
,
outCubic
,
inOutCubic
,
inQuart
,
outQuart
,
inOutQuart
,
inSine
,
outSine
,
inOutSine
,
inCirc
,
outCirc
,
inOutCirc
,
inQuint
,
outQuint
,
inOutQuint
,
inExponential
,
outExponential
,
inOutExponential
,
inElastic
,
outElastic
,
inOutElastic
,
inBack
,
outBack
,
inOutBack
,
inBounce
,
outBounce
,
inOutBounce
To see what they look like : Easings.net