Tweening.NumberTween

Description: Defines a NumberTween class that is used to move a number from a start value to an end value.

Extends: Tweening.Tween <number>

Constructors

NumberTween (from, to, duration, tweeningFunction)
Creates a new instance of the NumberTween object.

from: number
Start number.

to: number
End number.

duration: EndGate.TimeSpan
How fast to move the current number from start to end.

tweeningFunction: Tweening.Functions.ITweeningFunction
The function to use to translate the current number from start to end. Different functions result in different translation behavior.

Fields

Inherited from: Tweening.Tween <number>

OnChange: EndGate.EventHandler1 <T>
Gets an event that is triggered when the tween has changed its Current value, occurs directly after a tween update. Functions can be bound or unbound to this event to be executed when the event triggers.

OnComplete: EndGate.EventHandler1 <Tween>
Gets an event that is triggered when the tween has completed transitioning the Current value, once triggered Elapsed will be equivalent to Duration and Current will be equivalent to To. Functions can be bound or unbound to this event to be executed when the event triggers.

From: T
Gets or sets the From component of the tween.

To: T
Gets or sets the To component of the tween.

Current: T
Gets or sets the Current component of the tween. The Current is the current value of the tween, the final value of Current will be equivalent to To when the tween has completed.

Duration: EndGate.TimeSpan
Gets or sets the Duration component of the tween. The Duration is how long the tween will take to go From -> To.

Elapsed: EndGate.TimeSpan
Gets or the Elapsed component of the tween. Elapsed represents how far along the tween is. When Elapsed equals Duration the tween is completed.

TweeningFunction: Tweening.Functions.ITweeningFunction
Gets or sets the TweeningFunction of the tween. The TweeningFunction controls how the tween translates the Current value to the To value.

Methods

Inherited from: Tweening.Tween <number>

IsPlaying()
Determines if the tween is playing.

Play()
Starts playing the tween. The tween will only start translating the value if Update is called.

Pause()
Pauses the tween. Calls to update will not translate the tween when paused.

Reset()
Resets the tween to the To location and resets the Elapsed time. This does not stop or start the tween.

Stop()
Stops the tween from playing. This also resets the tween to its To value.

Restart()
Restarts the tween. Essentially calls Reset and then Play.

Reverse()
Reverses the tween from the Current value back to the From value. This changes the To component to equal the From value and the From value to equal the Current value.

Update()
Updates the tweens Current and Elapsed component if the tween is playing.

Dispose()
Stops and unbinds all events from the tween.

Examples

There's currently no example available for this page. If you'd like to suggest one send me an containing a description, code, and link to the page for the suggested example. As a thanks I'll associate the code snippet with your name directly below the example if approved.