Manipulating actors through actions
The Actions
class offers a large collection of common actions to easily manipulate
Actor
objects. Besides action-specific parameters such as the position for a move action, some actions also allow you to specify the duration as well as the interpolation algorithm to be used. An action will always complete in an instant if the duration is either omitted or set to 0
. Interpolation algorithms are provided by Libgdx's Interpolation
class.
Note
For a quick overview of the available interpolation algorithms in Libgdx, check out Chapter 9, Screen Transitions.
The following example illustrates the typical method signatures of two actions:
moveTo (x, y); moveTo (x, y, duration); moveTo (x, y, duration, interpolation); rotateTo (rotation); rotateTo (rotation, duration); rotateTo (rotation, duration, interpolation);
The moveTo()
and rotateTo()
actions both have their action-specific parameters x
, y
, and rotation
respectively, which are the absolute minimum requirement...