Skip to main content

FlixelNumTween

View source

class

org.flixelgdx.tween.type.FlixelNumTween

public class FlixelNumTween extends FlixelTween

Tween type that tweens one numerical value to another.

Constructors

FlixelNumTween(float, float, FlixelTweenSettings, UpdateCallback)

public FlixelNumTween(float start, float end, FlixelTweenSettings settings, UpdateCallback updateCallback)

Constructs a new numerical tween, which will tween a simple starting number to an ending value.

Parameters:

NameDescription
startThe starting value.
endThe ending value.
settingsThe settings that configure and determine how the tween should animate.
updateCallbackCallback function for updating any variable that needs the current value when the tween updates.

Fields

start

protected float start

The starting value of the tween.


end

protected float end

The target value of the tween.


value

protected float value

The current value of the tween.


range

protected float range

The range between the start and end values.


updateCallback

protected UpdateCallback updateCallback

Callback function for updating the value when the tween updates.


Methods

setTarget(float, float, UpdateCallback)

public FlixelNumTween setTarget(float from, float to, UpdateCallback updateCallback)

Reconfigures this tween for reuse (e.g. from pool). Call before FlixelNumTween.start().

Parameters:

NameDescription
fromStart value.
toEnd value.
updateCallbackCallback for each updated value.

Returns: this, for chaining.


isTweenOf(Object, String)

public boolean isTweenOf(Object object, String field)

updateTweenValues()

protected void updateTweenValues()

UpdateCallback

interface

org.flixelgdx.tween.type.FlixelNumTween.UpdateCallback

public static interface UpdateCallback

Functional interface for updating the numerical value when the tween updates. This is for updating any variable that needs the current value of the tween.

Methods

update(float)

public void update(float value)

A callback method that is called when the tween updates its value during its tweening (or animating) process.

Parameters:

NameDescription
valueThe new current value of the numerical tween during the animation.