9#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>
72 QML_VALUE_TYPE(phosphorProfile)
76 Q_PROPERTY(qreal duration READ duration WRITE setDuration)
77 Q_PROPERTY(
int minDistance READ minDistance WRITE setMinDistance)
78 Q_PROPERTY(
SequenceMode sequenceMode READ sequenceMode WRITE setSequenceMode)
79 Q_PROPERTY(
int staggerInterval READ staggerInterval WRITE setStaggerInterval)
80 Q_PROPERTY(QString presetName READ presetName WRITE setPresetName)
138 m_value.curve = c.
curve();
143 return m_value.effectiveDuration();
147 if (!std::isfinite(ms) || ms <= 0.0 || ms > Profile::MaxDurationMs) {
148 m_value.duration.reset();
151 m_value.duration = ms;
156 return m_value.effectiveMinDistance();
160 if (px < 0 || px > Profile::MaxMinDistancePx) {
161 m_value.minDistance.reset();
164 m_value.minDistance = px;
169 return static_cast<SequenceMode>(
static_cast<int>(m_value.effectiveSequenceMode()));
180 const int raw =
static_cast<int>(mode);
183 m_value.sequenceMode.reset();
191 return m_value.effectiveStaggerInterval();
195 if (ms < 0 || ms > Profile::MaxStaggerIntervalMs) {
196 m_value.staggerInterval.reset();
199 m_value.staggerInterval = ms;
204 return m_value.presetName.value_or(QString());
208 m_value.presetName = name;
218 return m_value.toJson();
238 return PhosphorProfile(Profile::fromJson(obj, registry ? *registry : sFallback));
245 return m_value == other.m_value;
249 return !(*
this == other);
String-id <-> curve factory registry.
Definition CurveRegistry.h:26
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:70
void setCurve(const PhosphorCurve &c)
Definition PhosphorProfile.h:136
QString presetName() const
Definition PhosphorProfile.h:202
SequenceMode sequenceMode() const
Definition PhosphorProfile.h:167
QJsonObject toJson() const
Serialize to a JSON object via Profile::toJson.
Definition PhosphorProfile.h:216
void setPresetName(const QString &name)
Definition PhosphorProfile.h:206
void setDuration(qreal ms)
Definition PhosphorProfile.h:145
PhosphorCurve curve() const
Definition PhosphorProfile.h:132
SequenceMode
Definition PhosphorProfile.h:87
bool operator!=(const PhosphorProfile &other) const
Definition PhosphorProfile.h:247
void setMinDistance(int px)
Definition PhosphorProfile.h:158
static PhosphorProfile fromJson(const QJsonObject &obj)
Parse from a JSON object.
Definition PhosphorProfile.h:234
int minDistance() const
Definition PhosphorProfile.h:154
qreal duration() const
Definition PhosphorProfile.h:141
int staggerInterval() const
Definition PhosphorProfile.h:189
bool operator==(const PhosphorProfile &other) const
Definition PhosphorProfile.h:243
void setSequenceMode(SequenceMode mode)
Definition PhosphorProfile.h:171
void setStaggerInterval(int ms)
Definition PhosphorProfile.h:193
const Profile & value() const
Read-only access to the underlying value.
Definition PhosphorProfile.h:106
Configuration for a single animation event.
Definition Profile.h:33
Definition AnimatedValue.h:32
SequenceMode
How a batch of animations starts. Numeric values match the historical wire format.
Definition Profile.h:21