![]() |
CUGL 3.0
Cornell University Game Library
|
#include <CUTransformAction2.h>
Public Member Functions | |
FadeBy () | |
~FadeBy () | |
void | dispose () |
bool | init () |
bool | init (float factor) |
float | getFactor () const |
void | setFactor (float factor) |
ActionFunction | attach (const std::shared_ptr< scene2::SceneNode > &node) |
Static Public Member Functions | |
static std::shared_ptr< FadeBy > | alloc () |
static std::shared_ptr< FadeBy > | alloc (float factor) |
This factory creates a fade-in/out animation by a certain factor.
Transparency is defined by the alpha value of the node color. Altering this value affects the visibility of the node. Unless the node is set for its children to inherit is color, this has no affect on the children of the node.
This animation multiplies the existing alpha of a node by a factor at the start of the animation. It then adjusts the alpha of the node until it reaches that value. A value greater than 1 increaes the node towards opacity while a factor less than 1 decreases it towards opacity. Note that a node that has an alpha of 0 (completely transparent) is unaffected by this animation.
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 fade-in/out animation
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 animation, disposing all resources
|
inlinestatic |
Returns a newly allocated degenerate fade-in/out animation.
This animation has a factor of 1, which means there is no change.
|
inlinestatic |
Returns a newly allocated fade-in/out animation for the given factor.
This animation multiplies the existing alpha of a node by the factor at the start of the animation. It then adjusts the alpha of the node until it reaches that value. A value greater than 1 increaes the node towards opacity while a factor less than 1 decreases it towards opacity. Note that a node that has an alpha of 0 (completely transparent) is unaffected by this animation.
The factor value should be >= 0, where 0 fades an object out to total transparency.
factor | The fade-in/out factor |
ActionFunction cugl::scene2::FadeBy::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 animation.
A disposed action can be safely reinitialized.
|
inline |
Returns the fade-in/out factor for this animation.
This animation multiplies the existing alpha of a node by the factor at the start of the animation. It then adjusts the alpha of the node until it reaches that value. A value greater than 1 increaes the node towards opacity while a factor less than 1 decreases it towards opacity. Note that a node that has an alpha of 0 (completely transparent) is unaffected by this animation.
Changing this value for an actively animating action can have undefined side effects.
|
inline |
Initializes a degenerate fade-in/out animation.
This animation has a factor of 1, which means there is no change.
bool cugl::scene2::FadeBy::init | ( | float | factor | ) |
Initializes a fade-in/out animation for the given factor.
This animation multiplies the existing alpha of a node by the factor at the start of the animation. It then adjusts the alpha of the node until it reaches that value. A value greater than 1 increaes the node towards opacity while a factor less than 1 decreases it towards opacity. Note that a node that has an alpha of 0 (completely transparent) is unaffected by this animation.
The factor value should be >= 0, where 0 fades an object out to total transparency.
factor | The fade-in/out factor |
|
inline |
Sets the fade-in/out factor for this animation.
This animation multiplies the existing alpha of a node by the factor at the start of the animation. It then adjusts the alpha of the node until it reaches that value. A value greater than 1 increaes the node towards opacity while a factor less than 1 decreases it towards opacity. Note that a node that has an alpha of 0 (completely transparent) is unaffected by this animation.
Changing this value for an actively animating action can have undefined side effects.
factor | The fade-in/out factor for this animation. |