1// Copyright (C) 2022 The Qt Company Ltd.
2// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
3
4#ifndef QQUICK3DPARTICLESCALEAFFECTOR_H
5#define QQUICK3DPARTICLESCALEAFFECTOR_H
6
7//
8// W A R N I N G
9// -------------
10//
11// This file is not part of the Qt API. It exists purely as an
12// implementation detail. This header file may change from version to
13// version without notice, or even be removed.
14//
15// We mean it.
16//
17
18#include <QtQuick3DParticles/private/qquick3dparticleaffector_p.h>
19#include <qeasingcurve.h>
20
21QT_BEGIN_NAMESPACE
22
23class Q_QUICK3DPARTICLES_EXPORT QQuick3DParticleScaleAffector : public QQuick3DParticleAffector
24{
25 Q_OBJECT
26 Q_PROPERTY(float minSize READ minSize WRITE setMinSize NOTIFY minSizeChanged)
27 Q_PROPERTY(float maxSize READ maxSize WRITE setMaxSize NOTIFY maxSizeChanged)
28 Q_PROPERTY(int duration READ duration WRITE setDuration NOTIFY durationChanged)
29 Q_PROPERTY(ScalingType type READ type WRITE setType NOTIFY typeChanged)
30 Q_PROPERTY(QEasingCurve easingCurve READ easingCurve WRITE setEasingCurve NOTIFY easingCurveChanged)
31 QML_NAMED_ELEMENT(ScaleAffector3D)
32 QML_ADDED_IN_VERSION(6, 4)
33public:
34 QQuick3DParticleScaleAffector(QQuick3DNode *parent = nullptr);
35
36 enum ScalingType
37 {
38 Linear,
39 SewSaw,
40 SineWave,
41 AbsSineWave,
42 Step,
43 SmoothStep,
44 };
45 Q_ENUM(ScalingType)
46
47 float minSize() const;
48 float maxSize() const;
49 int duration() const;
50 ScalingType type() const;
51 QEasingCurve easingCurve() const;
52
53public Q_SLOTS:
54 void setMinSize(float size);
55 void setMaxSize(float size);
56 void setDuration(int duration);
57 void setType(ScalingType type);
58 void setEasingCurve(const QEasingCurve &curve);
59
60Q_SIGNALS:
61 void minSizeChanged();
62 void maxSizeChanged();
63 void durationChanged();
64 void typeChanged();
65 void easingCurveChanged();
66
67protected:
68 void prepareToAffect() override;
69 void affectParticle(const QQuick3DParticleData &, QQuick3DParticleDataCurrent *d, float time) override;
70
71private:
72 float m_minSize = 1.0f;
73 float m_maxSize = 1.0f;
74 int m_duration = 1000;
75 ScalingType m_type = Linear;
76 QEasingCurve m_easing;
77};
78
79QT_END_NAMESPACE
80
81#endif
82

source code of qtquick3d/src/quick3dparticles/qquick3dparticlescaleaffector_p.h