Class RotateToAction
- java.lang.Object
-
- com.badlogic.gdx.scenes.scene2d.Action
-
- com.badlogic.gdx.scenes.scene2d.actions.TemporalAction
-
- com.badlogic.gdx.scenes.scene2d.actions.RotateToAction
-
- All Implemented Interfaces:
Pool.Poolable
public class RotateToAction extends TemporalAction
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.
-
-
Constructor Summary
Constructors Constructor Description RotateToAction()
RotateToAction(boolean useShortestDirection)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected void
begin()
Called the first timeTemporalAction.act(float)
is called.float
getRotation()
boolean
isUseShortestDirection()
void
setRotation(float rotation)
void
setUseShortestDirection(boolean useShortestDirection)
protected void
update(float percent)
Called each frame.-
Methods inherited from class com.badlogic.gdx.scenes.scene2d.actions.TemporalAction
act, end, finish, getDuration, getInterpolation, getTime, isComplete, isReverse, reset, restart, setDuration, setInterpolation, setReverse, setTime
-
-
-
-
Method Detail
-
begin
protected void begin()
Description copied from class:TemporalAction
Called the first timeTemporalAction.act(float)
is called. This is a good place to query theactor's
starting state.- Overrides:
begin
in classTemporalAction
-
update
protected void update(float percent)
Description copied from class:TemporalAction
Called each frame.- Specified by:
update
in classTemporalAction
- Parameters:
percent
- The percentage of completion for this action, growing from 0 to 1 over the duration. Ifreversed
, this will shrink from 1 to 0.
-
getRotation
public float getRotation()
-
setRotation
public void setRotation(float rotation)
-
isUseShortestDirection
public boolean isUseShortestDirection()
-
setUseShortestDirection
public void setUseShortestDirection(boolean useShortestDirection)
-
-