Parametric easing curve: cubic bezier, elastic, or bounce. More...
#include <phosphor-animation/include/PhosphorAnimation/Easing.h>
Public Types | |
| enum class | Type { CubicBezier , ElasticIn , ElasticOut , ElasticInOut , BounceIn , BounceOut , BounceInOut } |
Public Member Functions | |
| Easing ()=default | |
| Easing (const Easing &)=default | |
| Easing & | operator= (const Easing &)=default |
| Easing (Easing &&)=default | |
| Easing & | operator= (Easing &&)=default |
| QString | typeId () const override |
| Stable identifier for this curve subclass (e.g. "bezier", "spring"). | |
| qreal | evaluate (qreal x) const override |
| Evaluate at normalized time t in [0,1]. May overshoot by design. | |
| QString | toString () const override |
| Serialize to "typeId:params" or bare "x1,y1,x2,y2" for cubic-bezier. | |
| std::unique_ptr< Curve > | clone () const override |
| Deep copy with identical parameters. | |
| bool | overshoots () const override |
| True if this curve may evaluate outside [0,1] during progression. | |
| bool | equals (const Curve &other) const override |
| Same typeId + same parameters. | |
| bool | operator== (const Easing &other) const |
| bool | operator!= (const Easing &other) const |
Public Member Functions inherited from PhosphorAnimation::Curve | |
| virtual | ~Curve ()=default |
| virtual void | step (qreal dt, CurveState &state, qreal target) const |
Advance state by dt real seconds toward target. | |
| virtual bool | isStateful () const |
| True if this curve requires persistent CurveState across frames. | |
| virtual qreal | settleTime () const |
| Approximate settle time in seconds. | |
Static Public Member Functions | |
| static Easing | fromString (const QString &str) |
| Parse from config string. Returns default OutCubic on failure. | |
Public Attributes | |
| Type | type = Type::CubicBezier |
| qreal | x1 = 0.33 |
| Bezier control points (P1, P2). x clamped [0,1]; y clamped [-1,2]. | |
| qreal | y1 = 1.0 |
| qreal | x2 = 0.68 |
| qreal | y2 = 1.0 |
| qreal | amplitude = 1.0 |
| Elastic: oscillation intensity. Bounce: height scale. [0.5, 3.0]. | |
| qreal | period = 0.3 |
| Elastic oscillation period. [0.1, 1.0]. | |
| int | bounces = 3 |
| Bounce count. [1, 8]. | |
Additional Inherited Members | |
Protected Member Functions inherited from PhosphorAnimation::Curve | |
| Curve ()=default | |
| Curve (const Curve &)=default | |
| Curve & | operator= (const Curve &)=default |
| Curve (Curve &&)=default | |
| Curve & | operator= (Curve &&)=default |
Parametric easing curve: cubic bezier, elastic, or bounce.
All stateless. Default construction yields OutCubic bezier (0.33, 1.00, 0.68, 1.00). Value type with public fields — can be stack-allocated or stored inline.
|
strong |
|
default |
|
default |
|
default |
|
overridevirtual |
Deep copy with identical parameters.
Implements PhosphorAnimation::Curve.
|
overridevirtual |
Same typeId + same parameters.
Default compares toString() (2-decimal rounded); subclasses with precise floats should override.
Reimplemented from PhosphorAnimation::Curve.
|
overridevirtual |
Evaluate at normalized time t in [0,1]. May overshoot by design.
Implements PhosphorAnimation::Curve.
|
static |
Parse from config string. Returns default OutCubic on failure.
|
inline |
| bool PhosphorAnimation::Easing::operator== | ( | const Easing & | other | ) | const |
|
overridevirtual |
True if this curve may evaluate outside [0,1] during progression.
Reimplemented from PhosphorAnimation::Curve.
|
overridevirtual |
Serialize to "typeId:params" or bare "x1,y1,x2,y2" for cubic-bezier.
2-decimal float precision — round-trip is lossy.
Implements PhosphorAnimation::Curve.
|
overridevirtual |
Stable identifier for this curve subclass (e.g. "bezier", "spring").
Implements PhosphorAnimation::Curve.
| qreal PhosphorAnimation::Easing::amplitude = 1.0 |
Elastic: oscillation intensity. Bounce: height scale. [0.5, 3.0].
| int PhosphorAnimation::Easing::bounces = 3 |
Bounce count. [1, 8].
| qreal PhosphorAnimation::Easing::period = 0.3 |
Elastic oscillation period. [0.1, 1.0].
| Type PhosphorAnimation::Easing::type = Type::CubicBezier |
| qreal PhosphorAnimation::Easing::x1 = 0.33 |
Bezier control points (P1, P2). x clamped [0,1]; y clamped [-1,2].
| qreal PhosphorAnimation::Easing::x2 = 0.68 |
| qreal PhosphorAnimation::Easing::y1 = 1.0 |
| qreal PhosphorAnimation::Easing::y2 = 1.0 |