Package arc.scene.actions
Class RotateToAction
java.lang.Object
arc.scene.Action
arc.scene.actions.TemporalAction
arc.scene.actions.RotateToAction
- All Implemented Interfaces:
Pool.Poolable
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.
-
Field Summary
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionprotected void
begin()
Called the first timeTemporalAction.act(float)
is called.float
boolean
void
setRotation
(float rotation) void
setUseShortestDirection
(boolean useShortestDirection) protected void
update
(float percent) Called each frame.Methods inherited from class arc.scene.actions.TemporalAction
act, end, finish, getDuration, getInterpolation, getTime, isReverse, reset, restart, setDuration, setInterpolation, setReverse, setTime
-
Constructor Details
-
RotateToAction
public RotateToAction() -
RotateToAction
public RotateToAction(boolean useShortestDirection) - Parameters:
useShortestDirection
- Set to true to move directly to the closest angle
-
-
Method Details
-
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)
-