![]() |
CUGL 3.0
Cornell University Game Library
|
#include <CUTransformAction2.h>
Public Member Functions | |
RotateTo () | |
~RotateTo () | |
void | dispose () |
bool | init () |
bool | init (float angle) |
float | getAngle () const |
void | setAngle (float angle) |
ActionFunction | attach (const std::shared_ptr< scene2::SceneNode > &node) |
Static Public Member Functions | |
static std::shared_ptr< RotateTo > | alloc () |
static std::shared_ptr< RotateTo > | alloc (float angle) |
This factory creates an action rotating to a specific angle.
The angle is measured in radians, counter-clockwise from the x-axis.
This class is actually a factory for creating movement actions. To create an action, call attach
with the appropriate SceneNode
. Note that this class contains no duration information. That is supplied when the action is added to ActionTimeline
.
|
inline |
Creates an uninitialized rotation action.
NEVER USE A CONSTRUCTOR WITH NEW. If you want to allocate an object on the heap, use one of the static constructors instead.
|
inline |
Deletes this action instance, disposing all resources
|
inlinestatic |
Returns a newly allocated rotation animation towards the x-axis
The target angle is set to 0.0. Because of how rotatations are interpolated, this guarantees that the rotation will be clockwise.
|
inlinestatic |
Returns a newly allocated rotation animation towards the given angle
This angle is measured in radians, counter-clockwise from the x-axis. The animation will be counter-clockwise if the target angle is larger than the current one. Otherwise it will be clockwise.
angle | The target rotation angle |
ActionFunction cugl::scene2::RotateTo::attach | ( | const std::shared_ptr< scene2::SceneNode > & | node | ) |
Returns an action attaching this animation to the given scene node
This action will reference this object during the animation. Any changes to this object during that time may alter the animation.
Note that the action has no associated duration. That should be set when it is added to ActionTimeline
.
node | The node to attach |
|
inline |
Disposes all of the resources used by this action.
A disposed action can be safely reinitialized.
|
inline |
Returns the rotation target angle for this action.
Changing this value for an actively animating action can have undefined side effects.
|
inline |
Initializes a rotation animation towards the x-axis
The target angle is set to 0.0. Because of how rotatations are interpolated, this guarantees that the rotation will be clockwise.
bool cugl::scene2::RotateTo::init | ( | float | angle | ) |
Initializes a rotation animation towards the given angle
This angle is measured in radians, counter-clockwise from the x-axis. The animation will be counter-clockwise if the target angle is larger than the current one. Otherwise it will be clockwise.
angle | The target rotation angle |
|
inline |
Sets the rotation target angle for this action.
Changing this value for an actively animating action can have undefined side effects.
angle | The rotation target angle for this action. |