friz
An animation control system for JUCE
|
A class that generates a single constant value for its duration. More...
#include <constant.h>
Public Member Functions | |
Constant (float value, int duration) | |
Constant (float, float endVal, int duration) | |
An alternate constructor that can be used by the makeAnimation() factory function, which requires that all animation effects have separate start and end values. We ignore anything passed to the startValue argument. | |
Public Member Functions inherited from friz::TimedValue | |
TimedValue (float startVal, float endVal, int duration_) | |
float | getNextValue (int msElapsed, int) override |
bool | isFinished () override |
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. | |
Private Member Functions | |
float | generateNextValue (float progress) override |
generate the value according to progress in time. | |
Additional Inherited Members | |
Protected Member Functions inherited from friz::TimedValue | |
float | scale (float curvePoint) |
Given a fractional curve point (typically) in the range (0.f..1.f), interpolate this point between this value's start and end points. | |
Protected Attributes inherited from friz::TimedValue | |
int | duration |
duration of the event in ms. | |
Protected Attributes inherited from friz::AnimatedValue | |
float | startVal |
float | endVal |
float | currentVal |
bool | canceled { false } |
bool | finished { false } |
A class that generates a single constant value for its duration.
Wait – why would you need a constant value when you're trying to animate?
Consider this case: I have an an animation that's cyclic, and I want to be able to set it to run for some number of cycles that I don't know at compile time. An easy way to do this is to create an Animation object that has a Constant
value in it, and in the OnCompletion()
callback, check to see if that value is > 0 – if not, immediately recreate the animation, but decrement the constant loop count value.
friz::Constant::Constant | ( | float | value, |
int | duration | ||
) |
A value that doesn't change.
value | Value to generate. |
duration | # of milliseconds the effect should take. |
friz::Constant::Constant | ( | float | , |
float | endVal, | ||
int | duration | ||
) |
An alternate constructor that can be used by the makeAnimation()
factory function, which requires that all animation effects have separate start and end values. We ignore anything passed to the startValue argument.
startVal | ignored |
endVal | The only value this effect wil emit. |
duration | in milliseconds. |
|
overrideprivatevirtual |
generate the value according to progress in time.
progress | position in the animation (0.0..1.0) |
Implements friz::TimedValue.