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 QQUICKSMOOTHEDANIMATION_H
5#define QQUICKSMOOTHEDANIMATION_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 QQmlProperty;
26class QQuickSmoothedAnimationPrivate;
27class Q_QUICK_PRIVATE_EXPORT QQuickSmoothedAnimation : public QQuickNumberAnimation
28{
29 Q_OBJECT
30 Q_DECLARE_PRIVATE(QQuickSmoothedAnimation)
31
32 Q_PROPERTY(qreal velocity READ velocity WRITE setVelocity NOTIFY velocityChanged FINAL)
33 Q_PROPERTY(ReversingMode reversingMode READ reversingMode WRITE setReversingMode NOTIFY reversingModeChanged FINAL)
34 Q_PROPERTY(qreal maximumEasingTime READ maximumEasingTime WRITE setMaximumEasingTime NOTIFY maximumEasingTimeChanged FINAL)
35 QML_NAMED_ELEMENT(SmoothedAnimation)
36 QML_ADDED_IN_VERSION(2, 0)
37
38public:
39 enum ReversingMode { Eased, Immediate, Sync };
40 Q_ENUM(ReversingMode)
41
42 QQuickSmoothedAnimation(QObject *parent = nullptr);
43
44 ReversingMode reversingMode() const;
45 void setReversingMode(ReversingMode);
46
47 int duration() const override;
48 void setDuration(int) override;
49
50 qreal velocity() const;
51 void setVelocity(qreal);
52
53 int maximumEasingTime() const;
54 void setMaximumEasingTime(int);
55
56 QAbstractAnimationJob* transition(QQuickStateActions &actions,
57 QQmlProperties &modified,
58 TransitionDirection direction,
59 QObject *defaultTarget = nullptr) override;
60Q_SIGNALS:
61 void velocityChanged();
62 void reversingModeChanged();
63 void maximumEasingTimeChanged();
64};
65
66QT_END_NAMESPACE
67
68QML_DECLARE_TYPE(QQuickSmoothedAnimation)
69
70#endif // QQUICKSMOOTHEDANIMATION_H
71

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