CUGL 2.1
Cornell University Game Library
Public Member Functions | Static Public Member Functions | List of all members
cugl::scene2::FadeIn Class Reference

#include <CUFadeAction.h>

Inheritance diagram for cugl::scene2::FadeIn:
cugl::scene2::Action

Public Member Functions

 FadeIn ()
 
 ~FadeIn ()
 
void dispose ()
 
bool init ()
 
bool init (float time)
 
virtual std::shared_ptr< Actionclone () override
 
virtual void load (const std::shared_ptr< SceneNode > &target, Uint64 *state) override
 
virtual void update (const std::shared_ptr< SceneNode > &target, Uint64 *state, float dt) override
 
virtual std::string toString (bool verbose=false) const override
 
- Public Member Functions inherited from cugl::scene2::Action
 Action ()
 
 ~Action ()
 
float getDuration () const
 
void setDuration (float time)
 
 operator std::string () const
 

Static Public Member Functions

static std::shared_ptr< FadeInalloc ()
 
static std::shared_ptr< FadeInalloc (float time)
 

Additional Inherited Members

- Protected Attributes inherited from cugl::scene2::Action
float _duration
 

Detailed Description

This action represents a fade-in 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 is color, this will have no affect on the children of the node.

An action contains only the definition of the animation. This can include information about the transform to use or the duration of the animation. However, it does not contain any attribute of the target. Hence, an action can be reapplied to different targets.

By itself, an action does nothing. It only specifies an action that may take place. To use an action, it must be passed to the ActionManager. The manager will create an action instance and animate that instance. While an action may be reused many times, an action instance corresponds to a single animation.

Constructor & Destructor Documentation

◆ FadeIn()

cugl::scene2::FadeIn::FadeIn ( )
inline

Creates an uninitialized fade-in action.

NEVER USE A CONSTRUCTOR WITH NEW. If you want to allocate an object on the heap, use one of the static constructors instead.

◆ ~FadeIn()

cugl::scene2::FadeIn::~FadeIn ( )
inline

Deletes this action instance, disposing all resources

Member Function Documentation

◆ alloc() [1/2]

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

Returns a newly allocated, instantaneous fade-in towards 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 is color, this will have no affect on the children of the node.

Returns
a newly allocated, instantaneous fade-in towards opacity

◆ alloc() [2/2]

static std::shared_ptr<FadeIn> cugl::scene2::FadeIn::alloc ( float  time)
inlinestatic

Returns a newly allocated fade-in towards 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 is color, this will have no affect on the children of the node. The animation will take place over the given number of seconds.

Parameters
timeThe animation duration
Returns
a newly allocated fade-in towards opacity

◆ clone()

virtual std::shared_ptr<Action> cugl::scene2::FadeIn::clone ( )
overridevirtual

Returns a newly allocated copy of this Action.

Returns
a newly allocated copy of this Action.

Reimplemented from cugl::scene2::Action.

◆ dispose()

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

Disposes all of the resources used by this action.

A disposed action can be safely reinitialized.

◆ init() [1/2]

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

Initializes an instantaneous fade-in towards 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 is color, this will have no affect on the children of the node.

Returns
true if initialization was successful.

◆ init() [2/2]

bool cugl::scene2::FadeIn::init ( float  time)

Initializes an fade-in towards 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 is color, this will have no affect on the children of the node. The animation will take place over the given number of seconds.

Parameters
timeThe animation duration
Returns
true if initialization was successful.

◆ load()

virtual void cugl::scene2::FadeIn::load ( const std::shared_ptr< SceneNode > &  target,
Uint64 *  state 
)
overridevirtual

Prepares a target for action

The important state of the target is stored in the given state parameter. The semantics of this state is action-dependent.

Parameters
targetThe node to act on
stateThe relevant node state

Reimplemented from cugl::scene2::Action.

◆ toString()

virtual std::string cugl::scene2::FadeIn::toString ( bool  verbose = false) const
overridevirtual

Returns a string representation of the action for debugging purposes.

If verbose is true, the string will include class information. This allows us to unambiguously identify the class.

Parameters
verboseWhether to include class information
Returns
a string representation of this action for debuggging purposes.

Reimplemented from cugl::scene2::Action.

◆ update()

virtual void cugl::scene2::FadeIn::update ( const std::shared_ptr< SceneNode > &  target,
Uint64 *  state,
float  dt 
)
overridevirtual

Executes an action on the given target node.

The important state of the target is stored in the given state parameter. The semantics of this state is action-dependent.

Parameters
targetThe node to act on
stateThe relevant node state
dtThe elapsed time to animate.

Reimplemented from cugl::scene2::Action.


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