friz
An animation control system for JUCE
|
This class owns a number of AnimatedValue
objects. On each animation frame it gets the next calculated value from each of the value objects and passes those values to its OnUpdate
handler. When all of the values in the animation have reached their end states, calls the OnCompletion
handler.
More...
#include <animation.h>
Public Types | |
using | SourceList = std::array< std::unique_ptr< AnimatedValue >, ValueCount > |
using | ValueList = typename UpdateSource< ValueCount >::ValueList |
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 Types inherited from friz::UpdateSource< ValueCount > | |
using | ValueList = std::array< float, ValueCount > |
using | UpdateFn = std::function< void(int, const ValueList &)> |
Public Member Functions | |
Animation (int id=0) | |
Animation (SourceList &&sources, int id=0) | |
Construct a new Animation object, given a list of value sources. | |
bool | setValue (size_t index, std::unique_ptr< AnimatedValue > value) override |
AnimatedValue * | getValue (size_t index) override |
Retrieve a pointer to one of this animation's value sources. This should probably not be used very much, if ever. | |
Status | gotoTime (juce::int64 timeInMs) override |
Advance to the specified time, sending value updates to the code that's waiting for them. | |
void | cancel (bool moveToEndPosition) override |
Cancel an in-progress animation, optionally moving directly to its end value. | |
bool | isFinished () override |
bool | isReady () const override |
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 AnimatedValue * | getValue (size_t index)=0 |
Retrieve a pointer to one of this animation's value objects. | |
void | onCompletion (CompletionFn complete) |
Public Member Functions inherited from friz::UpdateSource< ValueCount > | |
void | onUpdate (UpdateFn update) |
Additional Inherited Members | |
Public Attributes inherited from friz::AnimationType | |
CompletionFn | completionFn |
function to call when the animation is completed or canceled. | |
Public Attributes inherited from friz::UpdateSource< ValueCount > | |
UpdateFn | updateFn |
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. | |
This class owns a number of AnimatedValue
objects. On each animation frame it gets the next calculated value from each of the value objects and passes those values to its OnUpdate
handler. When all of the values in the animation have reached their end states, calls the OnCompletion
handler.
Once this animation is complete, the Animator
object that owns it will garbage collect it.
|
inline |
Create an animation object that can be populated with changing values and functions to call at important points (each frame of animation, sequence completion)
id | Optional identifier, use as you wish. We don't enforce uniqueness, for example. Must be >= 0. |
|
inline |
Construct a new Animation object, given a list of value sources.
sources | List of animated value objects. |
id |
|
inlineoverridevirtual |
Cancel an in-progress animation, optionally moving directly to its end value.
moveToEndPosition | if true, go immediately to the end value. |
Implements friz::AnimationType.
|
inlineoverridevirtual |
Retrieve a pointer to one of this animation's value sources. This should probably not be used very much, if ever.
index |
Implements friz::AnimationType.
|
inlineoverridevirtual |
Advance to the specified time, sending value updates to the code that's waiting for them.
timeInMs | number of milliseconds since some fixed event in the past. |
processing
or finished
Implements friz::AnimationType.
|
inlineoverridevirtual |
Implements friz::AnimationType.
|
inlineoverridevirtual |
Implements friz::AnimationType.
|
inlineoverridevirtual |
Set the AnimatedValue object to use for one of this animation's slots.
index | Value index, 0..ValueCount-1 |
value | AnimatedValue object to generate data. |
Reimplemented from friz::AnimationType.