friz
An animation control system for JUCE
Loading...
Searching...
No Matches
friz::AnimatedValue Class Referenceabstract

Abstract base class for objects that can generate a useful series of values to drive UI animations. More...

#include <animatedValue.h>

Inheritance diagram for friz::AnimatedValue:

Public Member Functions

 AnimatedValue (float startVal_, float endVal_)
 Base class init for the animated value classes.
 
virtual float getNextValue (int msElapsed, int msSinceLastUpdate)=0
 
float getEndValue () const
 get the ending state of this value object. When we cancel an in-progress animation, we may need to snap to the end value, and this gives a way to get there immediately.
 
virtual bool isFinished ()=0
 
virtual bool updateTarget (float)
 Attempt to change the end value of an animation that's currently in process.
 
void cancel (bool moveToEndPosition)
 Cancel an in-progress animation.
 

Protected Attributes

float startVal
 
float endVal
 
float currentVal
 
bool canceled { false }
 
bool finished { false }
 

Private Member Functions

virtual void doCancel (bool moveToEndPosition)
 

Detailed Description

Abstract base class for objects that can generate a useful series of values to drive UI animations.

Constructor & Destructor Documentation

◆ AnimatedValue()

friz::AnimatedValue::AnimatedValue ( float  startVal_,
float  endVal_ 
)
inline

Base class init for the animated value classes.

Parameters
startValInitial Value
endValTarget/end value.

Member Function Documentation

◆ cancel()

void friz::AnimatedValue::cancel ( bool  moveToEndPosition)
inline

Cancel an in-progress animation.

Parameters
moveToEndPositionIf true, will immediately take the ending value; otherwise cancels at its current value.

◆ doCancel()

virtual void friz::AnimatedValue::doCancel ( bool  moveToEndPosition)
inlineprivatevirtual

Override in derived classes to perform any unusual cancellation logic.

◆ getEndValue()

float friz::AnimatedValue::getEndValue ( ) const
inline

get the ending state of this value object. When we cancel an in-progress animation, we may need to snap to the end value, and this gives a way to get there immediately.

Returns
float

◆ getNextValue()

virtual float friz::AnimatedValue::getNextValue ( int  msElapsed,
int  msSinceLastUpdate 
)
pure virtual

Derived classes should do whatever is needed to generate and return the next value.

Parameters
msElapsedtime since this value started running. (used by 'time-based' values)
msSinceLastUpdatetime since we were last evaluated (used by threshold-based values)
Returns
next value (or last value if we're finished)

Implemented in friz::TimedValue, and friz::ToleranceValue.

◆ isFinished()

virtual bool friz::AnimatedValue::isFinished ( )
pure virtual

Have we reached the end of this animation sequence? By default, we're done when the current value is within tolerance of the endValue (or if we've been canceled...)

Returns
true if this value has reached the end of its animation.

Implemented in friz::ToleranceValue, and friz::TimedValue.

◆ updateTarget()

virtual bool friz::AnimatedValue::updateTarget ( float  )
inlinevirtual

Attempt to change the end value of an animation that's currently in process.

Parameters
newValue
Returns
true If the value type supports this and the operation succeeded.

Reimplemented in friz::SmoothedValue.


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