Fork me on GitHub
View source

package com.haxepunk

class Tween


extends EventDispatcher
extended by Alarm, AngleTween, ColorTween, MultiVarTween, NumTween, VarTween, Motion, Fader, SfxFader

Base class for tweening helpers. A Tween is any object that interpolates something between two values. It does not have to be a linear path, for instance a circular motion.

Do not use this directly, instead use the classes in com.haxepunk.tweens.*

Constructor

View source

new (duration : Float, type : TweenType, complete : Dynamic ->Void, , ease : Float ->Float, ) : Void

Constructor. Specify basic information about the Tween.


Parameters:
duration   

Duration of the tween (in seconds or frames).

type   

Tween type, one of Tween.PERSIST (default), Tween.LOOPING, or Tween.ONESHOT.

complete   

Optional callback for when the Tween completes.

ease   

Optional easer function to apply to the Tweened value.

Variables

active : Bool

If the tween is active.

percent : Float

Progression of the tween, between 0 and 1.

read only scale : Float

Functions

View source

cancel () : Void

Immediately stops the Tween and removes it from its Tweener without calling the complete callback.

View source

start () : Void

Starts the Tween, or restarts it if it's currently running.