friz
An animation control system for JUCE
Loading...
Searching...
No Matches
friz::Chain Class Reference

A container animation object that holds several animations and executes them in order. More...

#include <chain.h>

Inheritance diagram for friz::Chain:

Public Member Functions

 Chain (int id=0)
 
bool isFinished () override
 
bool isReady () const override
 
AnimationType::Status gotoTime (juce::int64 timeInMs) override
 Advance all active animations to this point in time.
 
void cancel (bool moveToEndPosition) override
 Cancel an in-progress animation, optionally moving directly to its end value.
 
void addAnimation (std::unique_ptr< AnimationType > effect)
 
AnimatedValuegetValue (size_t index) override
 Retrieve a pointer to one of this animation's value objects.
 
- Public Member Functions inherited from friz::AnimationType
 AnimationType (int id)
 
int getId () const
 
void setDelay (int delay)
 
virtual bool setValue (size_t, std::unique_ptr< AnimatedValue >)
 
virtual Status gotoTime (juce::int64 timeInMs)=0
 Advance all active animations to this point in time.
 
virtual void cancel (bool moveToEndPosition)=0
 Cancel an in-progress animation, optionally moving directly to its end value.
 
virtual bool isFinished ()=0
 
virtual bool isReady () const =0
 
virtual AnimatedValuegetValue (size_t index)=0
 Retrieve a pointer to one of this animation's value objects.
 
void onCompletion (CompletionFn complete)
 

Protected Attributes

std::vector< std::unique_ptr< AnimationType > > sequence
 the vector that owns our chain of effects.
 
int currentEffect { 0 }
 index (into the sequence vector) of the effect that we are currently processing.
 
- Protected Attributes inherited from friz::AnimationType
int animationId { 0 }
 optional ID value for this animation.
 
int preDelay { 0 }
 an optional pre-delay before beginning to execute the effect.
 

Private Member Functions

AnimationTypegetEffect (int index)
 

Additional Inherited Members

- Public Types inherited from friz::AnimationType
enum class  Status { processing , finished }
 
using CompletionFn = std::function< void(int, bool)>
 callback on completion of this effect
 
- Public Attributes inherited from friz::AnimationType
CompletionFn completionFn
 function to call when the animation is completed or canceled.
 

Detailed Description

A container animation object that holds several animations and executes them in order.

This differs from the Sequence class in that the animations in a Chain do not need to use the same number of values.

See also
Sequence

Member Function Documentation

◆ cancel()

void friz::Chain::cancel ( bool  moveToEndPosition)
inlineoverridevirtual

Cancel an in-progress animation, optionally moving directly to its end value.

Parameters
moveToEndPositionif true, go immediately to the end value.

Implements friz::AnimationType.

◆ getEffect()

AnimationType * friz::Chain::getEffect ( int  index)
inlineprivate

Get a pointer to one of our effects by its index.

Parameters
index0..size-1
Returns
nullptr if index is out of range.

◆ getValue()

AnimatedValue * friz::Chain::getValue ( size_t  index)
inlineoverridevirtual

Retrieve a pointer to one of this animation's value objects.

Parameters
index
Returns
AnimatedValue*

Implements friz::AnimationType.

◆ gotoTime()

AnimationType::Status friz::Chain::gotoTime ( juce::int64  timeInMs)
inlineoverridevirtual

Advance all active animations to this point in time.

Parameters
timeInMsTime since some fixed event; only used internally to calculate deltas.
Returns
Status either processing or finished.

Implements friz::AnimationType.

◆ isFinished()

bool friz::Chain::isFinished ( )
inlineoverridevirtual
Returns
true if the effect has completed.

Implements friz::AnimationType.

◆ isReady()

bool friz::Chain::isReady ( ) const
inlineoverridevirtual
Returns
true if the animation is ready to be executed (e.g. has all its values set to valid AnimatedValue objects.)

Implements friz::AnimationType.


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