friz
An animation control system for JUCE
Loading...
Searching...
No Matches
friz::ToleranceValue Class Referenceabstract
Inheritance diagram for friz::ToleranceValue:

Public Member Functions

 ToleranceValue (float startVal, float endVal, float tolerance)
 
float getNextValue (int, int msSinceLastUpdate) override
 Calculate the next value in the sequence based on the delta time since last updated. Internally, we use an update rate of 1 kHz to recalculate values so that we can remain consistent as the actual animation frame rate changes.
 
bool isFinished () override
 Test to see if this value has reached its end state.
 
- Public Member Functions inherited from friz::AnimatedValue
 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 tolerance
 
- Protected Attributes inherited from friz::AnimatedValue
float startVal
 
float endVal
 
float currentVal
 
bool canceled { false }
 
bool finished { false }
 

Private Member Functions

float snapToEnd (float val)
 The underlying calculation (in floating point) may approach the desired end value asymptotically; we've already defined a tolerance value that's "close enough" to the end. When we get inside that tolerance, we snap to the end value and mark this object as finished.
 
virtual float generateNextValue ()=0
 Execute a single step of this curve's function.
 

Member Function Documentation

◆ generateNextValue()

virtual float friz::ToleranceValue::generateNextValue ( )
privatepure virtual

Execute a single step of this curve's function.

Returns
next value.

Implemented in friz::EaseIn, friz::EaseOut, and friz::Spring.

◆ getNextValue()

float friz::ToleranceValue::getNextValue ( int  ,
int  msSinceLastUpdate 
)
inlineoverridevirtual

Calculate the next value in the sequence based on the delta time since last updated. Internally, we use an update rate of 1 kHz to recalculate values so that we can remain consistent as the actual animation frame rate changes.

Parameters
msSinceLastUpdatea delta time since last updated.
Returns
the calculated value.

Implements friz::AnimatedValue.

◆ isFinished()

bool friz::ToleranceValue::isFinished ( )
inlineoverridevirtual

Test to see if this value has reached its end state.

Implements friz::AnimatedValue.

◆ snapToEnd()

float friz::ToleranceValue::snapToEnd ( float  val)
inlineprivate

The underlying calculation (in floating point) may approach the desired end value asymptotically; we've already defined a tolerance value that's "close enough" to the end. When we get inside that tolerance, we snap to the end value and mark this object as finished.


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