Phosphor
Qt6 / Wayland library suite for window-management tools
 
Loading...
Searching...
No Matches
PhosphorAnimation::PhosphorSpring Class Reference

QML value-type wrapper around PhosphorAnimation::Spring. More...

#include <phosphor-animation/include/PhosphorAnimation/PhosphorSpring.h>

Public Member Functions

 PhosphorSpring ()=default
 
 PhosphorSpring (const Spring &value)
 Implicit-conversion ctor for core-library code.
 
 PhosphorSpring (qreal omega, qreal zeta)
 
const Springvalue () const
 Read-only access to the underlying value.
 
qreal omega () const
 
void setOmega (qreal v)
 
qreal zeta () const
 
void setZeta (qreal v)
 
QString toString () const
 Canonical wire format from PhosphorAnimation::Spring::toString.
 
bool operator== (const PhosphorSpring &other) const
 
bool operator!= (const PhosphorSpring &other) const
 

Static Public Member Functions

static PhosphorSpring fromString (const QString &str)
 Parse "spring:omega,zeta" or "omega,zeta".
 
static PhosphorSpring snappy ()
 Responsive, slight overshoot. Good default for window snap.
 
static PhosphorSpring smooth ()
 Critically damped. No overshoot, firm approach.
 
static PhosphorSpring bouncy ()
 Visible bounce. Good for attention-grabbing feedback.
 

Detailed Description

QML value-type wrapper around PhosphorAnimation::Spring.

Q_GADGET per Phase 4 decision O — value semantics. Usable as a property shape inside PhosphorProfile { curve: PhosphorSpring { omega: 14; zeta: 0.6 } }.

Parameter bounds (omega ∈ [0.1, 200], zeta ∈ [0.0, 10.0]) are enforced inside the C++ Spring constructor; writes through these setters clamp identically. Preset factories (snappy / smooth / bouncy) are re-exposed as Q_INVOKABLE static helpers so QML authors can reference the same named tunings C++ consumers use.

Constructor & Destructor Documentation

◆ PhosphorSpring() [1/3]

PhosphorAnimation::PhosphorSpring::PhosphorSpring ( )
default

◆ PhosphorSpring() [2/3]

PhosphorAnimation::PhosphorSpring::PhosphorSpring ( const Spring value)
inlineexplicit

Implicit-conversion ctor for core-library code.

◆ PhosphorSpring() [3/3]

PhosphorAnimation::PhosphorSpring::PhosphorSpring ( qreal  omega,
qreal  zeta 
)
inline

Member Function Documentation

◆ bouncy()

static PhosphorSpring PhosphorAnimation::PhosphorSpring::bouncy ( )
inlinestatic

Visible bounce. Good for attention-grabbing feedback.

◆ fromString()

static PhosphorSpring PhosphorAnimation::PhosphorSpring::fromString ( const QString &  str)
inlinestatic

Parse "spring:omega,zeta" or "omega,zeta".

Invalid input yields a default-constructed Spring (omega=12, zeta=0.8).

◆ omega()

qreal PhosphorAnimation::PhosphorSpring::omega ( ) const
inline

◆ operator!=()

bool PhosphorAnimation::PhosphorSpring::operator!= ( const PhosphorSpring other) const
inline

◆ operator==()

bool PhosphorAnimation::PhosphorSpring::operator== ( const PhosphorSpring other) const
inline

◆ setOmega()

void PhosphorAnimation::PhosphorSpring::setOmega ( qreal  v)
inline

◆ setZeta()

void PhosphorAnimation::PhosphorSpring::setZeta ( qreal  v)
inline

◆ smooth()

static PhosphorSpring PhosphorAnimation::PhosphorSpring::smooth ( )
inlinestatic

Critically damped. No overshoot, firm approach.

◆ snappy()

static PhosphorSpring PhosphorAnimation::PhosphorSpring::snappy ( )
inlinestatic

Responsive, slight overshoot. Good default for window snap.

◆ toString()

QString PhosphorAnimation::PhosphorSpring::toString ( ) const
inline

Canonical wire format from PhosphorAnimation::Spring::toString.

◆ value()

const Spring & PhosphorAnimation::PhosphorSpring::value ( ) const
inline

Read-only access to the underlying value.

The non-const overload was deliberately removed: a mutable handle from QML let scripts bypass the setter clamps in setOmega / setZeta by writing directly into the underlying Spring fields. Core-library mutators construct a fresh Spring and assign.

◆ zeta()

qreal PhosphorAnimation::PhosphorSpring::zeta ( ) const
inline

The documentation for this class was generated from the following file: