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),
96 return static_cast<Type>(
static_cast<int>(m_value.type));
100 m_value.type =
static_cast<Easing::Type>(
static_cast<int>(t));
109 if (!std::isfinite(v)) {
112 m_value.x1 = qBound(0.0, v, 1.0);
120 if (!std::isfinite(v)) {
123 m_value.y1 = qBound(-1.0, v, 2.0);
131 if (!std::isfinite(v)) {
134 m_value.x2 = qBound(0.0, v, 1.0);
142 if (!std::isfinite(v)) {
145 m_value.y2 = qBound(-1.0, v, 2.0);
150 return m_value.amplitude;
154 if (!std::isfinite(v)) {
157 m_value.amplitude = qBound(0.5, v, 3.0);
161 return m_value.period;
165 if (!std::isfinite(v)) {
168 m_value.period = qBound(0.1, v, 1.0);
172 return m_value.bounces;
176 m_value.bounces = qBound(1, v, 8);
184 return m_value.toString();
199 return m_value == other.m_value;
203 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:182
Type
Definition PhosphorEasing.h:56
void setX1(qreal v)
Definition PhosphorEasing.h:107
void setType(Type t)
Definition PhosphorEasing.h:98
qreal amplitude() const
Definition PhosphorEasing.h:148
bool operator==(const PhosphorEasing &other) const
Definition PhosphorEasing.h:197
int bounces() const
Definition PhosphorEasing.h:170
bool operator!=(const PhosphorEasing &other) const
Definition PhosphorEasing.h:201
void setBounces(int v)
Definition PhosphorEasing.h:174
qreal y2() const
Definition PhosphorEasing.h:136
qreal x1() const
Definition PhosphorEasing.h:103
qreal y1() const
Definition PhosphorEasing.h:114
static PhosphorEasing fromString(const QString &str)
Parse the same wire format.
Definition PhosphorEasing.h:190
const Easing & value() const
Read-only access to the underlying value.
Definition PhosphorEasing.h:80
qreal x2() const
Definition PhosphorEasing.h:125
void setY2(qreal v)
Definition PhosphorEasing.h:140
void setX2(qreal v)
Definition PhosphorEasing.h:129
void setY1(qreal v)
Definition PhosphorEasing.h:118
void setAmplitude(qreal v)
Definition PhosphorEasing.h:152
qreal period() const
Definition PhosphorEasing.h:159
void setPeriod(qreal v)
Definition PhosphorEasing.h:163
Type type() const
Definition PhosphorEasing.h:94
Definition AnimatedValue.h:31