You.i Engine
CYIAnimationToggleController Class Reference

Detailed Description

This controller can be used to animate between two visual states using one or two timelines.

Provides an interface for co-ordinating two visual states with animations between them. One or two timelines can be provided in SetTimelines(), and this controller will manage playing the appropriate timeline in the appropriate direction when the CYIAnimationToggleController::State is changed.

#include <animation/YiAnimationToggleController.h>

Inheritance diagram for CYIAnimationToggleController:

Public Types

enum  State {
  State::Off = 0,
  State::On
}
 

Public Member Functions

 CYIAnimationToggleController ()
 
 CYIAnimationToggleController (CYIAnimationToggleController &&other)
 
virtual ~CYIAnimationToggleController ()
 
void SetTimelines (CYIAbstractTimeline *pTimelineOn, CYIAbstractTimeline *pTimelineOff=nullptr)
 
void SetTimelines (std::unique_ptr< CYIAbstractTimeline > pTimelineOn, std::unique_ptr< CYIAbstractTimeline > pTimelineOff)
 
State GetState () const
 
bool IsAnimating () const
 
void ToggleOn ()
 
void ToggleOff ()
 
void ToggleToState (State state)
 
bool IsToggledOn () const
 
bool IsToggledOff () const
 
void Toggle ()
 
void ResetToState (State state)
 
- Public Member Functions inherited from CYISignalHandler
 CYISignalHandler ()
 
 CYISignalHandler (const CYISignalHandler &rSignalHandler)
 
virtual ~CYISignalHandler ()
 
CYISignalHandleroperator= (const CYISignalHandler &rSignalHandler)
 
void MoveToThread (CYIThread *pThread)
 This function allows the user to override the default thread affinity to any CYIThread that may or may not be running. More...
 
CYIThreadHandle GetThreadAffinity () const
 
void SetThreadAffinity (const CYIThreadHandle &rThreadAffinity)
 
virtual bool IsConnected () const
 
virtual bool IsConnected (const CYISignalBase &rSignal) const
 
void Disconnect (CYISignalBase &rSignal)
 
void DisconnectFromAllSignals ()
 
- Public Member Functions inherited from CYIThread::Listener
 Listener ()
 
virtual ~Listener ()
 
virtual void OnThreadStarted (CYIThread *)
 
virtual void OnThreadTerminated (CYIThread *)
 
virtual void OnThreadFinished (CYIThread *)
 

Public Attributes

CYISignal< StateStateChanged
 
CYISignal< StateAnimationEnded
 

Member Enumeration Documentation

◆ State

See also
GetState
Enumerator
Off 
On 

Constructor & Destructor Documentation

◆ CYIAnimationToggleController() [1/2]

CYIAnimationToggleController::CYIAnimationToggleController ( )

◆ CYIAnimationToggleController() [2/2]

CYIAnimationToggleController::CYIAnimationToggleController ( CYIAnimationToggleController &&  other)

◆ ~CYIAnimationToggleController()

virtual CYIAnimationToggleController::~CYIAnimationToggleController ( )
virtual

Member Function Documentation

◆ GetState()

State CYIAnimationToggleController::GetState ( ) const

Returns the current state. The initial state is CYIAnimationToggleController::State::Off for a newly constructed object.

◆ IsAnimating()

bool CYIAnimationToggleController::IsAnimating ( ) const

Returns true if one of the timelines is playing.

◆ IsToggledOff()

bool CYIAnimationToggleController::IsToggledOff ( ) const

Returns true if this controller is in the CYIAnimationToggleController::State::Off state.

See also
ToggleOff

◆ IsToggledOn()

bool CYIAnimationToggleController::IsToggledOn ( ) const

Returns true if this controller is in the CYIAnimationToggleController::State::On state.

See also
ToggleOn

◆ ResetToState()

void CYIAnimationToggleController::ResetToState ( State  state)

Immediately transitions this controller to state without playing any timelines or emitting the CYIAnimationToggleController::StateChanged signal. The CYIAnimationToggleController::AnimationEnded signal will be emitted immediately.

◆ SetTimelines() [1/2]

void CYIAnimationToggleController::SetTimelines ( CYIAbstractTimeline pTimelineOn,
CYIAbstractTimeline pTimelineOff = nullptr 
)

Specifies the timelines to be controlled. pTimelineOn is mandatory and pTimelineOff is optional. Pass nullptr to indicate there is no 'off' timeline.

If both timelines are specified:

  • pTimelineOn will be played when toggling on unless pTimelineOff is currently playing, in which case pTimelineOff will be played in reverse.
  • pTimelineOff will be played when toggling off unless pTimelineOn is currently playing, in which case pTimelineOn will be played in reverse.

If only pTimelineOn is specified:

  • pTimelineOn will be played when toggling on.
  • pTimelineOn will be played in reverse when toggling off.

ResetToState() will be called with the current CYIAnimationToggleController::State so the new timelines provided take effect immediately.

This function does not take ownership of the provided timelines.

◆ SetTimelines() [2/2]

void CYIAnimationToggleController::SetTimelines ( std::unique_ptr< CYIAbstractTimeline pTimelineOn,
std::unique_ptr< CYIAbstractTimeline pTimelineOff 
)

Specifies the timelines to be controlled. pTimelineOn is mandatory and pTimelineOff is optional. Pass nullptr to indicate there is no 'off' timeline.

If both timelines are specified:

  • pTimelineOn will be played when toggling on unless pTimelineOff is currently playing, in which case pTimelineOff will be played in reverse.
  • pTimelineOff will be played when toggling off unless pTimelineOn is currently playing, in which case pTimelineOn will be played in reverse.

If only pTimelineOn is specified:

  • pTimelineOn will be played when toggling on.
  • pTimelineOn will be played in reverse when toggling off.

ResetToState() will be called with the current CYIAnimationToggleController::State so the new timelines provided take effect immediately.

◆ Toggle()

void CYIAnimationToggleController::Toggle ( )

Immediately transitions this controller to the opposite state, then plays the appropriate timeline.

See also
ToggleOn
ToggleOff
SetTimelines

◆ ToggleOff()

void CYIAnimationToggleController::ToggleOff ( )

Immediately transitions this controller to the CYIAnimationToggleController::State::Off state, then plays the appropriate timeline.

See also
SetTimelines

◆ ToggleOn()

void CYIAnimationToggleController::ToggleOn ( )

Immediately transitions this controller to the CYIAnimationToggleController::State::On state, then plays the appropriate timeline.

See also
SetTimelines

◆ ToggleToState()

void CYIAnimationToggleController::ToggleToState ( State  state)

Member Data Documentation

◆ AnimationEnded

CYISignal<State> CYIAnimationToggleController::AnimationEnded

Emitted when the animation to the new state ends.

◆ StateChanged

CYISignal<State> CYIAnimationToggleController::StateChanged

Emitted when the controller's state has changed.

See also
ToggleOn
ToggleOff
ToggleToState
Toggle
ResetToState

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