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

#include <CUTransformAction2.h>

Public Member Functions

 FadeTo ()
 
 ~FadeTo ()
 
void dispose ()
 
bool initOut ()
 
bool initIn ()
 
bool init (float target)
 
ActionFunction attach (const std::shared_ptr< scene2::SceneNode > &node)
 

Static Public Member Functions

static std::shared_ptr< FadeToallocOut ()
 
static std::shared_ptr< FadeToallocIn ()
 
static std::shared_ptr< FadeToalloc (float target)
 

Detailed Description

This factory creates a fade-in/out animation towards a specific opacity.

When applied to a node, this action will adjust the alpha value of the node color until it reaches the target value (which should be between 0 and 1). Unless the node is set for its children to inherit is color, this will have no affect on the children of the node.

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

◆ FadeTo()

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

◆ ~FadeTo()

cugl::scene2::FadeTo::~FadeTo ( )
inline

Deletes this animation, disposing all resources

Member Function Documentation

◆ alloc()

static std::shared_ptr< FadeTo > cugl::scene2::FadeTo::alloc ( float  target)
inlinestatic

Returns a newly allocated fade animation towards a target opacity

When applied to a node, this action will adjust the alpha value of the node color until it is eventually the target value (which should be between 0 and 1). Unless the node is set for its children to inherit its color, this will have no affect on the children of the node.

Parameters
targetThe target opacity
Returns
a newly allocated fade animation towards a target opacity

◆ allocIn()

static std::shared_ptr< FadeTo > cugl::scene2::FadeTo::allocIn ( )
inlinestatic

Returns a newly allocated fade animation towards total opacity

When applied to a node, this action will adjust the alpha value of the node color until it is eventually 1. Unless the node is set for its children to inherit its color, this will have no affect on the children of the node.

Returns
a newly allocated fade animation towards total opacity

◆ allocOut()

static std::shared_ptr< FadeTo > cugl::scene2::FadeTo::allocOut ( )
inlinestatic

Returns a newly allocated fade animation towards total transparency

When applied to a node, this action will adjust the alpha value of the node color until it is eventually 0. Unless the node is set for its children to inherit its color, this will have no affect on the children of the node.

Returns
a newly allocated fade animation towards total transparency

◆ attach()

ActionFunction cugl::scene2::FadeTo::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::FadeTo::dispose ( )
inline

Disposes all of the resources used by this animation.

A disposed action can be safely reinitialized.

◆ init()

bool cugl::scene2::FadeTo::init ( float  target)

Initializes a fade animation towards a target opacity

When applied to a node, this action will adjust the alpha value of the node color until it is eventually the target value (which should be between 0 and 1). Unless the node is set for its children to inherit its color, this will have no affect on the children of the node.

Parameters
targetThe target opacity
Returns
true if initialization was successful.

◆ initIn()

bool cugl::scene2::FadeTo::initIn ( )
inline

Initializes a fade animation towards total opacity

When applied to a node, this action will adjust the alpha value of the node color until it is eventually 1. Unless the node is set for its children to inherit its color, this will have no affect on the children of the node.

Returns
true if initialization was successful.

◆ initOut()

bool cugl::scene2::FadeTo::initOut ( )
inline

Initializes a fade animation towards total transparency

When applied to a node, this action will adjust the alpha value of the node color until it is eventually 0. Unless the node is set for its children to inherit its color, this will have no affect on the children of the node.

Returns
true if initialization was successful.

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