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 QQUICKANIMATION_P_H
5#define QQUICKANIMATION_P_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 "qquickitemanimation_p.h"
19
20#if QT_CONFIG(quick_path)
21#include <private/qquickpath_p.h>
22#endif
23#include <private/qquickanimation_p_p.h>
24
25QT_BEGIN_NAMESPACE
26
27class QQuickParentAnimationPrivate : public QQuickAnimationGroupPrivate
28{
29 Q_DECLARE_PUBLIC(QQuickParentAnimation)
30public:
31 QQuickParentAnimationPrivate()
32 : QQuickAnimationGroupPrivate(), target(nullptr), newParent(nullptr), via(nullptr) {}
33
34 QQuickItem *target;
35 QQuickItem *newParent;
36 QQuickItem *via;
37
38 QPointF computeTransformOrigin(QQuickItem::TransformOrigin origin, qreal width, qreal height) const;
39};
40
41class QQuickAnchorAnimationPrivate : public QQuickAbstractAnimationPrivate
42{
43 Q_DECLARE_PUBLIC(QQuickAnchorAnimation)
44public:
45 QQuickAnchorAnimationPrivate() : interpolator(QVariantAnimationPrivate::getInterpolator(interpolationType: QMetaType::QReal)), duration(250) {}
46
47 QVariantAnimation::Interpolator interpolator;
48 int duration;
49 QEasingCurve easing;
50 QList<QQuickItem*> targets;
51};
52
53#if QT_CONFIG(quick_path)
54
55class QQuickPathAnimationUpdater : public QQuickBulkValueUpdater
56{
57public:
58 QQuickPathAnimationUpdater() : path(nullptr), pathLength(0), target(nullptr), reverse(false),
59 fromIsSourced(false), fromIsDefined(false), toIsDefined(false),
60 toX(0), toY(0), currentV(0), orientation(QQuickPathAnimation::Fixed),
61 entryInterval(0), exitInterval(0) {}
62
63 void setValue(qreal v) override;
64
65 QQuickPath *path;
66
67 QPainterPath painterPath;
68 QQuickCachedBezier prevBez;
69 qreal pathLength;
70 QList<QQuickPath::AttributePoint> attributePoints;
71
72 QQuickItem *target;
73 bool reverse;
74 bool fromIsSourced;
75 bool fromIsDefined;
76 bool toIsDefined;
77 qreal toX;
78 qreal toY;
79 qreal currentV;
80 QQmlNullableValue<qreal> interruptStart;
81 //TODO: bundle below into common struct
82 QQuickPathAnimation::Orientation orientation;
83 QPointF anchorPoint;
84 qreal entryInterval;
85 qreal exitInterval;
86 QQmlNullableValue<qreal> endRotation;
87 QQmlNullableValue<qreal> startRotation;
88};
89
90class QQuickPathAnimationPrivate;
91class QQuickPathAnimationAnimator : public QQuickBulkValueAnimator
92{
93public:
94 QQuickPathAnimationAnimator(QQuickPathAnimationPrivate * = nullptr);
95 ~QQuickPathAnimationAnimator();
96
97 void clearTemplate() { animationTemplate = nullptr; }
98
99 QQuickPathAnimationUpdater *pathUpdater() const { return static_cast<QQuickPathAnimationUpdater*>(getAnimValue()); }
100private:
101 QQuickPathAnimationPrivate *animationTemplate;
102};
103
104class QQuickPathAnimationPrivate : public QQuickAbstractAnimationPrivate
105{
106 Q_DECLARE_PUBLIC(QQuickPathAnimation)
107public:
108 QQuickPathAnimationPrivate() : path(nullptr), target(nullptr),
109 orientation(QQuickPathAnimation::Fixed), entryDuration(0), exitDuration(0), duration(250) {}
110
111 QQuickPath *path;
112 QQuickItem *target;
113 QQuickPathAnimation::Orientation orientation;
114 QPointF anchorPoint;
115 qreal entryDuration;
116 qreal exitDuration;
117 QQmlNullableValue<qreal> endRotation;
118 int duration;
119 QEasingCurve easingCurve;
120 QHash<QQuickItem*, QQuickPathAnimationAnimator* > activeAnimations;
121};
122
123#endif
124
125QT_END_NAMESPACE
126
127#endif // QQUICKANIMATION_P_H
128

source code of qtdeclarative/src/quick/items/qquickitemanimation_p_p.h