APIdia Launch Partner
Top Description Fields Constructors Methods
com.badlogic.gdx.scenes.scene2d.actions

public abstract Class TemporalAction

extends Action
implements FinishableAction
Class Inheritance
All Implemented Interfaces
com.badlogic.gdx.scenes.scene2d.actions.FinishableAction
Known Direct Subclasses
com.badlogic.gdx.scenes.scene2d.actions.RelativeTemporalAction, com.badlogic.gdx.scenes.scene2d.actions.AlphaAction, com.badlogic.gdx.scenes.scene2d.actions.ColorAction, com.badlogic.gdx.scenes.scene2d.actions.FloatAction, com.badlogic.gdx.scenes.scene2d.actions.IntAction, com.badlogic.gdx.scenes.scene2d.actions.MoveToAction, com.badlogic.gdx.scenes.scene2d.actions.RotateToAction, com.badlogic.gdx.scenes.scene2d.actions.ScaleToAction, com.badlogic.gdx.scenes.scene2d.actions.SizeToAction
Imports
com.badlogic.gdx.math.Interpolation, com.badlogic.gdx.scenes.scene2d.Action, com.badlogic.gdx.utils.Null, .Pool

Base class for actions that transition over time using the percent complete.
Author
Nathan Sweet

Field Summary

Modifier and TypeField and Description
private boolean
private boolean
private float
private Interpolation
private boolean
private float
Inherited from com.badlogic.gdx.scenes.scene2d.Action:
actortarget

Constructor Summary

AccessConstructor and Description
public
public
TemporalAction(float duration)

public
TemporalAction(float duration, Interpolation interpolation)

Method Summary

Modifier and TypeMethod and Description
public boolean
act(float delta)

Implements abstract com.badlogic.gdx.scenes.scene2d.Action.act.

Updates the action based on time.

protected void
begin()

Called the first time act(float) is called.

protected void
end()

Called the last time act(float) is called.

public void
finish()

Implements com.badlogic.gdx.scenes.scene2d.actions.FinishableAction.finish.

Skips to the end of the transition.

public float
public Interpolation
public float
getTime()

Gets the transition time so far.

public boolean
isComplete()

Returns true after act(float) has been called where time >= duration.

public boolean
public void
reset()

Overrides com.badlogic.gdx.scenes.scene2d.Action.reset.

Implements com.badlogic.gdx.utils.Pool.Poolable.reset.

Resets the optional state of this action to as if it were newly created, allowing the action to be pooled and reused.

public void
restart()

Overrides com.badlogic.gdx.scenes.scene2d.Action.restart.

Sets the state of the action so it can be run again.

public void
setDuration(float duration)

Sets the length of the transition in seconds.

public void
public void
setReverse(boolean reverse)

When true, the action's progress will go from 100% to 0%.

public void
setTime(float time)

Sets the transition time so far.

protected abstract void
update(float
The percentage of completion for this action, growing from 0 to 1 over the duration. If reversed, this will shrink from 1 to 0.
percent
)

Called each frame.

Inherited from com.badlogic.gdx.scenes.scene2d.Action:
getActorgetPoolgetTargetsetActorsetPoolsetTargettoString

Field Detail

beganback to summary
private boolean began
completeback to summary
private boolean complete
durationback to summary
private float duration
interpolationback to summary
private Interpolation interpolation
Annotations
@Null
reverseback to summary
private boolean reverse
timeback to summary
private float time

Constructor Detail

TemporalActionback to summary
public TemporalAction()
TemporalActionback to summary
public TemporalAction(float duration)
TemporalActionback to summary
public TemporalAction(float duration, Interpolation interpolation)

Method Detail

actback to summary
public boolean act(float delta)

Implements abstract com.badlogic.gdx.scenes.scene2d.Action.act.

Doc from com.badlogic.gdx.scenes.scene2d.Action.act.

Updates the action based on time. Typically this is called each frame by Actor#act(float).

beginback to summary
protected void begin()

Called the first time act(float) is called. This is a good place to query the actor's starting state.

endback to summary
protected void end()

Called the last time act(float) is called.

finishback to summary
public void finish()

Implements com.badlogic.gdx.scenes.scene2d.actions.FinishableAction.finish.

Skips to the end of the transition.

getDurationback to summary
public float getDuration()
getInterpolationback to summary
public Interpolation getInterpolation()
Annotations
@Null
getTimeback to summary
public float getTime()

Gets the transition time so far.

isCompleteback to summary
public boolean isComplete()

Returns true after act(float) has been called where time >= duration.

isReverseback to summary
public boolean isReverse()
resetback to summary
public void reset()

Overrides com.badlogic.gdx.scenes.scene2d.Action.reset.

Implements com.badlogic.gdx.utils.Pool.Poolable.reset.

Doc from com.badlogic.gdx.scenes.scene2d.Action.reset.

Resets the optional state of this action to as if it were newly created, allowing the action to be pooled and reused. State required to be set for every usage of this action or computed during the action does not need to be reset.

The default implementation calls restart().

If a subclass has optional state, it must override this method, call super, and reset the optional state.

restartback to summary
public void restart()

Overrides com.badlogic.gdx.scenes.scene2d.Action.restart.

Doc from com.badlogic.gdx.scenes.scene2d.Action.restart.

Sets the state of the action so it can be run again.

setDurationback to summary
public void setDuration(float duration)

Sets the length of the transition in seconds.

setInterpolationback to summary
public void setInterpolation(Interpolation interpolation)
setReverseback to summary
public void setReverse(boolean reverse)

When true, the action's progress will go from 100% to 0%.

setTimeback to summary
public void setTime(float time)

Sets the transition time so far.

updateback to summary
protected abstract void update(float percent)

Called each frame.

Parameters
percent:float

The percentage of completion for this action, growing from 0 to 1 over the duration. If reversed, this will shrink from 1 to 0.