8#include <PhosphorAnimation/phosphoranimation_export.h>
11#include <QtCore/QJsonObject>
12#include <QtCore/QObject>
13#include <QtCore/QString>
14#include <QtCore/QtMath>
15#include <QtQml/qqmlregistration.h>
52 QML_VALUE_TYPE(phosphorProfile)
56 Q_PROPERTY(qreal duration READ duration WRITE setDuration)
57 Q_PROPERTY(
int minDistance READ minDistance WRITE setMinDistance)
58 Q_PROPERTY(
SequenceMode sequenceMode READ sequenceMode WRITE setSequenceMode)
59 Q_PROPERTY(
int staggerInterval READ staggerInterval WRITE setStaggerInterval)
60 Q_PROPERTY(QString presetName READ presetName WRITE setPresetName)
105 m_value.curve = c.
curve();
110 return m_value.effectiveDuration();
114 if (!std::isfinite(ms) || ms <= 0.0 || ms > Profile::MaxDurationMs) {
115 m_value.duration.reset();
118 m_value.duration = ms;
123 return m_value.effectiveMinDistance();
128 m_value.minDistance.reset();
131 m_value.minDistance = px;
136 return static_cast<SequenceMode>(
static_cast<int>(m_value.effectiveSequenceMode()));
145 return m_value.effectiveStaggerInterval();
149 if (ms < 0 || ms > Profile::MaxStaggerIntervalMs) {
150 m_value.staggerInterval.reset();
153 m_value.staggerInterval = ms;
158 return m_value.presetName.value_or(QString());
162 m_value.presetName = name;
172 return m_value.toJson();
192 return PhosphorProfile(Profile::fromJson(obj, registry ? *registry : sFallback));
199 return m_value == other.m_value;
203 return !(*
this == other);
String-id <-> curve factory registry.
Definition CurveRegistry.h:22
Opaque QML value-type wrapper around shared_ptr<const Curve>.
Definition PhosphorCurve.h:47
std::shared_ptr< const Curve > curve() const
The wrapped pointer. May be null on a default-constructed handle.
Definition PhosphorCurve.h:64
QML value-type wrapper around PhosphorAnimation::Profile.
Definition PhosphorProfile.h:50
void setCurve(const PhosphorCurve &c)
Definition PhosphorProfile.h:103
QString presetName() const
Definition PhosphorProfile.h:156
SequenceMode sequenceMode() const
Definition PhosphorProfile.h:134
QJsonObject toJson() const
Serialize to a JSON object via Profile::toJson.
Definition PhosphorProfile.h:170
void setPresetName(const QString &name)
Definition PhosphorProfile.h:160
void setDuration(qreal ms)
Definition PhosphorProfile.h:112
PhosphorCurve curve() const
Definition PhosphorProfile.h:99
SequenceMode
Definition PhosphorProfile.h:67
bool operator!=(const PhosphorProfile &other) const
Definition PhosphorProfile.h:201
void setMinDistance(int px)
Definition PhosphorProfile.h:125
static PhosphorProfile fromJson(const QJsonObject &obj)
Parse from a JSON object.
Definition PhosphorProfile.h:188
int minDistance() const
Definition PhosphorProfile.h:121
qreal duration() const
Definition PhosphorProfile.h:108
int staggerInterval() const
Definition PhosphorProfile.h:143
bool operator==(const PhosphorProfile &other) const
Definition PhosphorProfile.h:197
void setSequenceMode(SequenceMode mode)
Definition PhosphorProfile.h:138
void setStaggerInterval(int ms)
Definition PhosphorProfile.h:147
const Profile & value() const
Read-only access to the underlying value.
Definition PhosphorProfile.h:85
Configuration for a single animation event.
Definition Profile.h:33
Definition AnimatedValue.h:31
SequenceMode
How a batch of animations starts. Numeric values match the historical wire format.
Definition Profile.h:21