1// Copyright (C) 2016 The Qt Company Ltd.
2// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
3
4#ifndef QQUICKSPRINGANIMATION_H
5#define QQUICKSPRINGANIMATION_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 <qqml.h>
19#include "qquickanimation_p.h"
20
21#include <QtCore/qobject.h>
22
23QT_BEGIN_NAMESPACE
24
25class QQuickSpringAnimationPrivate;
26class Q_QUICK_PRIVATE_EXPORT QQuickSpringAnimation : public QQuickNumberAnimation
27{
28 Q_OBJECT
29 Q_DISABLE_COPY_MOVE(QQuickSpringAnimation)
30 Q_DECLARE_PRIVATE(QQuickSpringAnimation)
31 Q_INTERFACES(QQmlPropertyValueSource)
32
33 Q_PROPERTY(qreal velocity READ velocity WRITE setVelocity FINAL)
34 Q_PROPERTY(qreal spring READ spring WRITE setSpring FINAL)
35 Q_PROPERTY(qreal damping READ damping WRITE setDamping FINAL)
36 Q_PROPERTY(qreal epsilon READ epsilon WRITE setEpsilon FINAL)
37 Q_PROPERTY(qreal modulus READ modulus WRITE setModulus NOTIFY modulusChanged FINAL)
38 Q_PROPERTY(qreal mass READ mass WRITE setMass NOTIFY massChanged FINAL)
39 QML_NAMED_ELEMENT(SpringAnimation)
40 QML_ADDED_IN_VERSION(2, 0)
41
42public:
43 QQuickSpringAnimation(QObject *parent=nullptr);
44 ~QQuickSpringAnimation();
45
46 qreal velocity() const;
47 void setVelocity(qreal velocity);
48
49 qreal spring() const;
50 void setSpring(qreal spring);
51
52 qreal damping() const;
53 void setDamping(qreal damping);
54
55 qreal epsilon() const;
56 void setEpsilon(qreal epsilon);
57
58 qreal mass() const;
59 void setMass(qreal modulus);
60
61 qreal modulus() const;
62 void setModulus(qreal modulus);
63
64 QAbstractAnimationJob* transition(QQuickStateActions &actions,
65 QQmlProperties &modified,
66 TransitionDirection direction,
67 QObject *defaultTarget = nullptr) override;
68
69Q_SIGNALS:
70 void modulusChanged();
71 void massChanged();
72 void syncChanged();
73};
74
75QT_END_NAMESPACE
76
77QML_DECLARE_TYPE(QQuickSpringAnimation)
78
79#endif // QQUICKSPRINGANIMATION_H
80

source code of qtdeclarative/src/quick/util/qquickspringanimation_p.h