Polymorphic base for all animation curves. More...
#include <phosphor-animation/include/PhosphorAnimation/Curve.h>
Public Member Functions | |
| virtual | ~Curve ()=default |
| virtual QString | typeId () const =0 |
| Stable identifier for this curve subclass (e.g. "bezier", "spring"). | |
| virtual qreal | evaluate (qreal t) const =0 |
| Evaluate at normalized time t in [0,1]. May overshoot by design. | |
| 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 bool | overshoots () const |
| True if this curve may evaluate outside [0,1] during progression. | |
| virtual qreal | settleTime () const |
| Approximate settle time in seconds. | |
| virtual QString | toString () const =0 |
| Serialize to "typeId:params" or bare "x1,y1,x2,y2" for cubic-bezier. | |
| virtual std::unique_ptr< Curve > | clone () const =0 |
| Deep copy with identical parameters. | |
| virtual bool | equals (const Curve &other) const |
| Same typeId + same parameters. | |
Protected Member Functions | |
| Curve ()=default | |
| Curve (const Curve &)=default | |
| Curve & | operator= (const Curve &)=default |
| Curve (Curve &&)=default | |
| Curve & | operator= (Curve &&)=default |
Polymorphic base for all animation curves.
Uses a polymorphic hierarchy (not std::variant) so third parties can register additional curve types at runtime via CurveRegistry. Immutable after construction through the shared call path (shared_ptr<const Curve>).
Two progression models:
Thread-safe: all const methods callable from any thread. step() mutates only the caller-owned CurveState.
|
virtualdefault |
|
protecteddefault |
|
protecteddefault |
|
protecteddefault |
|
pure virtual |
Deep copy with identical parameters.
Implemented in PhosphorAnimation::Easing, and PhosphorAnimation::Spring.
|
virtual |
Same typeId + same parameters.
Default compares toString() (2-decimal rounded); subclasses with precise floats should override.
Reimplemented in PhosphorAnimation::Easing, and PhosphorAnimation::Spring.
|
pure virtual |
Evaluate at normalized time t in [0,1]. May overshoot by design.
Implemented in PhosphorAnimation::Spring, and PhosphorAnimation::Easing.
|
inlinevirtual |
True if this curve requires persistent CurveState across frames.
Reimplemented in PhosphorAnimation::Spring.
|
inlinevirtual |
True if this curve may evaluate outside [0,1] during progression.
Reimplemented in PhosphorAnimation::Easing, and PhosphorAnimation::Spring.
|
inlinevirtual |
Approximate settle time in seconds.
Parametric: 1.0 (the [0,1] domain). Spring: analytical 99% settle time. Never infinity.
Reimplemented in PhosphorAnimation::Spring.
|
virtual |
Advance state by dt real seconds toward target.
dt <= 0 is a no-op. Default impl maps to parametric evaluation using state.startValue/time/duration. For retarget with stateless curves: set startValue = value, time = 0 before changing target.
Reimplemented in PhosphorAnimation::Spring.
|
pure virtual |
Serialize to "typeId:params" or bare "x1,y1,x2,y2" for cubic-bezier.
2-decimal float precision — round-trip is lossy.
Implemented in PhosphorAnimation::Easing, and PhosphorAnimation::Spring.
|
pure virtual |
Stable identifier for this curve subclass (e.g. "bezier", "spring").
Implemented in PhosphorAnimation::Easing, and PhosphorAnimation::Spring.