42 : startVal { startVal_ }
44 , currentVal { startVal_ } {
59 virtual float getNextValue (
int msElapsed,
int msSinceLastUpdate) = 0;
107 if (moveToEndPosition)
116 bool canceled {
false };
117 bool finished {
false };
125 , tolerance { tolerance }
139 jassert (msSinceLastUpdate >= 0);
140 if (msSinceLastUpdate == 0)
143 for (
int i { 0 }; i < msSinceLastUpdate; ++i)
161 return (finished || canceled);
174 if (std::fabs (val - endVal) < tolerance)
196 TimedValue (
float startVal,
float endVal,
int duration_)
210 float progress {
static_cast<float> (msElapsed) /
duration };
224 float scale (
float curvePoint) {
return startVal + curvePoint * (endVal - startVal); }
247inline float sin_f (
float v)
249 return static_cast<float> (std::sin (v));
252inline float cos_f (
float v)
254 return static_cast<float> (std::cos (v));
257inline float pow_f (
float v,
float pow)
259 return static_cast<float> (std::pow (v, pow));
Abstract base class for objects that can generate a useful series of values to drive UI animations.
Definition: animatedValue.h:34
virtual void doCancel(bool moveToEndPosition)
Definition: animatedValue.h:105
virtual float getNextValue(int msElapsed, int msSinceLastUpdate)=0
virtual bool isFinished()=0
void cancel(bool moveToEndPosition)
Cancel an in-progress animation.
Definition: animatedValue.h:92
virtual bool updateTarget(float)
Attempt to change the end value of an animation that's currently in process.
Definition: animatedValue.h:84
AnimatedValue(float startVal_, float endVal_)
Base class init for the animated value classes.
Definition: animatedValue.h:41
float getEndValue() const
get the ending state of this value object. When we cancel an in-progress animation,...
Definition: animatedValue.h:68
Definition: animatedValue.h:194
float getNextValue(int msElapsed, int) override
Definition: animatedValue.h:202
float scale(float curvePoint)
Given a fractional curve point (typically) in the range (0.f..1.f), interpolate this point between th...
Definition: animatedValue.h:224
bool isFinished() override
Definition: animatedValue.h:214
int duration
duration of the event in ms.
Definition: animatedValue.h:237
virtual float generateNextValue(float progress)=0
generate the value according to progress in time.
Definition: animatedValue.h:121
float snapToEnd(float val)
The underlying calculation (in floating point) may approach the desired end value asymptotically; we'...
Definition: animatedValue.h:172
virtual float generateNextValue()=0
Execute a single step of this curve's function.
bool isFinished() override
Test to see if this value has reached its end state.
Definition: animatedValue.h:156
float getNextValue(int, int msSinceLastUpdate) override
Calculate the next value in the sequence based on the delta time since last updated....
Definition: animatedValue.h:137