7#include <PhosphorAnimation/phosphoranimation_export.h>
9#include <QtCore/QObject>
10#include <QtCore/QString>
11#include <QtCore/QtGlobal>
12#include <QtQml/qqmlregistration.h>
40 QML_VALUE_TYPE(phosphorEasing)
43 Q_PROPERTY(
Type type READ type WRITE setType)
44 Q_PROPERTY(qreal x1 READ x1 WRITE setX1)
45 Q_PROPERTY(qreal y1 READ y1 WRITE setY1)
46 Q_PROPERTY(qreal x2 READ x2 WRITE setX2)
47 Q_PROPERTY(qreal y2 READ y2 WRITE setY2)
48 Q_PROPERTY(qreal amplitude READ amplitude WRITE setAmplitude)
49 Q_PROPERTY(qreal period READ period WRITE setPeriod)
50 Q_PROPERTY(
int bounces READ bounces WRITE setBounces)
57 CubicBezier = int(Easing::Type::CubicBezier),
58 ElasticIn = int(Easing::Type::ElasticIn),
59 ElasticOut = int(Easing::Type::ElasticOut),
60 ElasticInOut = int(Easing::Type::ElasticInOut),
61 BounceIn = int(Easing::Type::BounceIn),
62 BounceOut = int(Easing::Type::BounceOut),
63 BounceInOut = int(Easing::Type::BounceInOut),
100 return static_cast<Type>(
static_cast<int>(m_value.type));
104 m_value.type =
static_cast<Easing::Type>(
static_cast<int>(t));
109 m_value.amplitude = Easing::clampAmplitude(m_value.type, m_value.amplitude, m_value.period);
118 if (!std::isfinite(v)) {
121 m_value.x1 = qBound(0.0, v, 1.0);
129 if (!std::isfinite(v)) {
132 m_value.y1 = qBound(-1.0, v, 2.0);
140 if (!std::isfinite(v)) {
143 m_value.x2 = qBound(0.0, v, 1.0);
151 if (!std::isfinite(v)) {
154 m_value.y2 = qBound(-1.0, v, 2.0);
159 return m_value.amplitude;
163 if (!std::isfinite(v)) {
166 m_value.amplitude = Easing::clampAmplitude(m_value.type, v, m_value.period);
170 return m_value.period;
174 if (!std::isfinite(v)) {
177 m_value.period = qBound(Easing::MinElasticPeriod, v, Easing::MaxElasticPeriod);
181 m_value.amplitude = Easing::clampAmplitude(m_value.type, m_value.amplitude, m_value.period);
185 return m_value.bounces;
189 m_value.bounces = qBound(1, v, 8);
197 return m_value.toString();
212 return m_value == other.m_value;
216 return !(*
this == other);
Parametric easing curve: cubic bezier, elastic, or bounce.
Definition Easing.h:18
Type
Definition Easing.h:20
QML value-type wrapper around PhosphorAnimation::Easing.
Definition PhosphorEasing.h:38
QString toString() const
Canonical wire format from PhosphorAnimation::Easing::toString.
Definition PhosphorEasing.h:195
Type
Definition PhosphorEasing.h:56
void setX1(qreal v)
Definition PhosphorEasing.h:116
void setType(Type t)
Definition PhosphorEasing.h:102
qreal amplitude() const
Definition PhosphorEasing.h:157
bool operator==(const PhosphorEasing &other) const
Definition PhosphorEasing.h:210
int bounces() const
Definition PhosphorEasing.h:183
bool operator!=(const PhosphorEasing &other) const
Definition PhosphorEasing.h:214
void setBounces(int v)
Definition PhosphorEasing.h:187
qreal y2() const
Definition PhosphorEasing.h:145
qreal x1() const
Definition PhosphorEasing.h:112
qreal y1() const
Definition PhosphorEasing.h:123
static PhosphorEasing fromString(const QString &str)
Parse the same wire format.
Definition PhosphorEasing.h:203
const Easing & value() const
Read-only access to the underlying value.
Definition PhosphorEasing.h:80
qreal x2() const
Definition PhosphorEasing.h:134
void setY2(qreal v)
Definition PhosphorEasing.h:149
void setX2(qreal v)
Definition PhosphorEasing.h:138
void setY1(qreal v)
Definition PhosphorEasing.h:127
void setAmplitude(qreal v)
Definition PhosphorEasing.h:161
qreal period() const
Definition PhosphorEasing.h:168
void setPeriod(qreal v)
Definition PhosphorEasing.h:172
Type type() const
Definition PhosphorEasing.h:98
Definition AnimatedValue.h:32