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

public Class RotateToAction

extends TemporalAction
Class Inheritance
Imports
com.badlogic.gdx.math.MathUtils

Sets the actor's rotation from its current value to a specific value. By default, the rotation will take you from the starting value to the specified value via simple subtraction. For example, setting the start at 350 and the target at 10 will result in 340 degrees of movement. If the action is instead set to useShortestDirection instead, it will rotate straight to the target angle, regardless of where the angle starts and stops. For example, starting at 350 and rotating to 10 will cause 20 degrees of rotation.
Author
Nathan Sweet
See Also
com.badlogic.gdx.math.MathUtils#lerpAngleDeg(float, float, float)

Field Summary

Modifier and TypeField and Description
private float
private float
private boolean

Constructor Summary

AccessConstructor and Description
public
public
RotateToAction(boolean
Set to true to move directly to the closest angle
useShortestDirection
)

Method Summary

Modifier and TypeMethod and Description
protected void
public float
public boolean
public void
setRotation(float rotation)

public void
setUseShortestDirection(boolean useShortestDirection)

protected void
update(float percent)

Implements abstract com.badlogic.gdx.scenes.scene2d.actions.TemporalAction.update.

Called each frame.

Inherited from com.badlogic.gdx.scenes.scene2d.actions.TemporalAction:
actendfinishgetDurationgetInterpolationgetTimeisCompleteisReverseresetrestartsetDurationsetInterpolationsetReversesetTime

Field Detail

endback to summary
private float end
startback to summary
private float start
useShortestDirectionback to summary
private boolean useShortestDirection

Constructor Detail

RotateToActionback to summary
public RotateToAction()
RotateToActionback to summary
public RotateToAction(boolean useShortestDirection)
Parameters
useShortestDirection:boolean

Set to true to move directly to the closest angle

Method Detail

beginback to summary
protected void begin()

Overrides com.badlogic.gdx.scenes.scene2d.actions.TemporalAction.begin.

Doc from com.badlogic.gdx.scenes.scene2d.actions.TemporalAction.begin.

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

getRotationback to summary
public float getRotation()
isUseShortestDirectionback to summary
public boolean isUseShortestDirection()
setRotationback to summary
public void setRotation(float rotation)
setUseShortestDirectionback to summary
public void setUseShortestDirection(boolean useShortestDirection)
updateback to summary
protected void update(float percent)

Implements abstract com.badlogic.gdx.scenes.scene2d.actions.TemporalAction.update.

Doc from com.badlogic.gdx.scenes.scene2d.actions.TemporalAction.update.

Called each frame.