A class that can generate different parametric easing curves.
More...
#include <parametric.h>
|
enum | CurveType {
kLinear = 0
, kEaseInSine
, kEaseOutSine
, kEaseInOutSine
,
kEaseInQuad
, kEaseOutQuad
, kEaseInOutQuad
, kEaseInCubic
,
kEaseOutCubic
, kEaseInOutCubic
, kEaseInQuartic
, kEaseOutQuartic
,
kEaseInOutQuartic
, kEaseInQuintic
, kEaseOutQuintic
, kEaseInOutQuintic
,
kEaseInExpo
, kEaseOutExpo
, kEaseInOutExpo
, kEaseInCirc
,
kEaseOutCirc
, kEaseInOutCirc
, kEaseInBack
, kEaseOutBack
,
kEaseInOutBack
, kEaseInElastic
, kEaseOutElastic
, kEaseInOutElastic
,
kEaseInBounce
, kEaseOutBounce
, kEaseInOutBounce
} |
|
using | CurveFn = std::function< float(float)> |
|
|
| Parametric (CurveType type, float startVal, float endVal, int duration) |
| Construct a new Parametric object As of version 2.1, this ctor is deprecated; prefer to use the constructor that has the CurveType argument last.
|
|
| Parametric (float startVal, float endVal, int duration, CurveType type) |
| Construct a new Parametric object As of version 2.1, this ctor is deprecated; prefer to use the constructor that has the CurveType argument last.
|
|
void | SetCurve (CurveFn curve) |
| Set a new curve function for the generator.
|
|
| TimedValue (float startVal, float endVal, int duration_) |
|
float | getNextValue (int msElapsed, int) override |
|
bool | isFinished () override |
|
| 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.
|
|
|
float | generateNextValue (float progress) override |
| generate the value according to progress in time.
|
|
|
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.
|
|
int | duration |
| duration of the event in ms.
|
|
float | startVal |
|
float | endVal |
|
float | currentVal |
|
bool | canceled { false } |
|
bool | finished { false } |
|
A class that can generate different parametric easing curves.
We use formulas that are available (and demonstrated!) on
https://easings.net
◆ Parametric() [1/2]
friz::Parametric::Parametric |
( |
CurveType |
type, |
|
|
float |
startVal, |
|
|
float |
endVal, |
|
|
int |
duration |
|
) |
| |
Construct a new Parametric object As of version 2.1, this ctor is deprecated; prefer to use the constructor that has the CurveType argument last.
- Parameters
-
type | Type of curve to use. |
startVal | |
endVal | |
duration | in ms |
◆ Parametric() [2/2]
friz::Parametric::Parametric |
( |
float |
startVal, |
|
|
float |
endVal, |
|
|
int |
duration, |
|
|
CurveType |
type |
|
) |
| |
Construct a new Parametric object As of version 2.1, this ctor is deprecated; prefer to use the constructor that has the CurveType argument last.
- Parameters
-
startVal | |
endVal | |
duration | in ms |
type | Type of curve to use. |
◆ generateNextValue()
float friz::Parametric::generateNextValue |
( |
float |
progress | ) |
|
|
overrideprivatevirtual |
generate the value according to progress in time.
- Parameters
-
progress | position in the animation (0.0..1.0) |
- Returns
- next value.
Implements friz::TimedValue.
◆ SetCurve()
void friz::Parametric::SetCurve |
( |
CurveFn |
curve | ) |
|
Set a new curve function for the generator.
- Parameters
-
The documentation for this class was generated from the following files:
- Source/friz/curves/parametric.h
- Source/friz/curves/parametric.cpp