7#include <PhosphorAnimation/phosphoranimation_export.h>
50 std::unique_ptr<Curve>
clone()
const override;
58 static std::optional<Spring>
tryParse(
const QString& str);
72 return !(*
this == other);
bool equals(const Curve &other) const override
Same typeId + same parameters.
std::unique_ptr< Curve > clone() const override
Deep copy with identical parameters.
bool operator==(const Spring &other) const
Spring & operator=(const Spring &)=default
Spring(qreal omega, qreal zeta)
static std::optional< Spring > tryParse(const QString &str)
Parse from "spring:omega,zeta" or "omega,zeta".
QString typeId() const override
Stable identifier for this curve subclass (e.g. "bezier", "spring").
static constexpr qreal MaxSettleSeconds
Hard ceiling on settleTime(), in seconds.
Definition Spring.h:31
qreal zeta
Damping ratio. [0.0, 10.0].
Definition Spring.h:67
static Spring snappy()
Responsive, slight overshoot.
static Spring smooth()
Critically damped, no overshoot.
Spring(Spring &&)=default
Spring & operator=(Spring &&)=default
qreal settleTime() const override
Approximate settle time in seconds.
bool operator!=(const Spring &other) const
Definition Spring.h:70
static Spring fromString(const QString &str)
tryParse, or the default spring when str is malformed.
Spring(const Spring &)=default
static Spring bouncy()
Visible bounce.
qreal evaluate(qreal t) const override
Evaluate at normalized time t in [0,1]. May overshoot by design.
qreal omega
Angular natural frequency (rad/s). [0.1, 200].
Definition Spring.h:66
void step(qreal dt, CurveState &state, qreal target) const override
Advance state by dt real seconds toward target.
bool isStateful() const override
True if this curve requires persistent CurveState across frames.
Definition Spring.h:44
bool overshoots() const override
True for underdamped (zeta < 1). Critical/overdamped never overshoot.
QString toString() const override
Serialize to "typeId:params" or bare "x1,y1,x2,y2" for cubic-bezier.
Definition AnimatedValue.h:32
Mutable state for stateful curve progression (springs carry position+velocity across frames; stateles...
Definition Curve.h:20