CUGL 3.0
Cornell University Game Library
Loading...
Searching...
No Matches
Public Member Functions | Static Public Member Functions | List of all members
cugl::scene2::FadeBy Class Reference

#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< FadeByalloc ()
 
static std::shared_ptr< FadeByalloc (float factor)
 

Detailed Description

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.

Constructor & Destructor Documentation

◆ FadeBy()

cugl::scene2::FadeBy::FadeBy ( )
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.

◆ ~FadeBy()

cugl::scene2::FadeBy::~FadeBy ( )
inline

Deletes this animation, disposing all resources

Member Function Documentation

◆ alloc() [1/2]

static std::shared_ptr< FadeBy > cugl::scene2::FadeBy::alloc ( )
inlinestatic

Returns a newly allocated degenerate fade-in/out animation.

This animation has a factor of 1, which means there is no change.

Returns
a newly allocated degenerate fade-in/out animation.

◆ alloc() [2/2]

static std::shared_ptr< FadeBy > cugl::scene2::FadeBy::alloc ( float  factor)
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.

Parameters
factorThe fade-in/out factor
Returns
a newly allocated fade-in/out animation for the given factor.

◆ attach()

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.

Parameters
nodeThe node to attach
Returns
an action attaching this animation to the given scene node

◆ dispose()

void cugl::scene2::FadeBy::dispose ( )
inline

Disposes all of the resources used by this animation.

A disposed action can be safely reinitialized.

◆ getFactor()

float cugl::scene2::FadeBy::getFactor ( ) const
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.

Returns
the fade-in/out factor for this animation.

◆ init() [1/2]

bool cugl::scene2::FadeBy::init ( )
inline

Initializes a degenerate fade-in/out animation.

This animation has a factor of 1, which means there is no change.

Returns
true if initialization was successful.

◆ init() [2/2]

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.

Parameters
factorThe fade-in/out factor
Returns
true if initialization was successful.

◆ setFactor()

void cugl::scene2::FadeBy::setFactor ( float  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.

Parameters
factorThe fade-in/out factor for this animation.

The documentation for this class was generated from the following file: