1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
|
// Copyright (C) 2017 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#include "qabstractanimation.h"
#include "Qt3DAnimation/private/qabstractanimation_p.h"
QT_BEGIN_NAMESPACE
namespace Qt3DAnimation {
/*!
\class Qt3DAnimation::QAbstractAnimation
\brief An abstract base class for Qt3D animations.
\inmodule Qt3DAnimation
\since 5.9
\inherits QObject
Qt3DAnimation::QAbstractAnimation is an abstract base class for all animations.
Qt3DAnimation::QAbstractAnimation can not be directly instantiated, but rather
through its subclasses. QAbstractAnimation specifies common properties
for all Qt3D animations, such as animation name and type, current position and animation
duration, while leaving the actual animating for the subclasses.
*/
/*!
\qmltype AbstractAnimation
\brief An abstract base type for Qt3D animations.
\inqmlmodule Qt3D.Animation
\since 5.9
\nativetype Qt3DAnimation::QAbstractAnimation
AbstractAnimation is an abstract base type for all animations.
AbstractAnimation can not be directly instantiated, but rather
through its subtypes. AbstractAnimation specifies common properties
for all Qt3D animations, such as animation type, current position and animation
duration, while leaving the actual animating for the subtypes.
*/
/*!
\enum Qt3DAnimation::QAbstractAnimation::AnimationType
This enumeration specifies the type of the animation
\value KeyframeAnimation Simple keyframe animation implementation for QTransform
\value MorphingAnimation Blend-shape morphing animation
\value VertexBlendAnimation Vertex-blend animation
*/
/*!
\property Qt3DAnimation::QAbstractAnimation::animationName
Holds the name of the animation.
*/
/*!
\property Qt3DAnimation::QAbstractAnimation::animationType
Holds the type of the animation.
*/
/*!
\property Qt3DAnimation::QAbstractAnimation::position
Holds the current position of the animation.
*/
/*!
\property Qt3DAnimation::QAbstractAnimation::duration
Holds the duration of the animation.
*/
/*!
\qmlproperty string Qt3D.Animation::AbstractAnimation::animationName
Holds the name of the animation.
*/
/*!
\qmlproperty enumeration Qt3D.Animation::AbstractAnimation::animationType
Holds the type of the animation.
\list
\li KeyframeAnimation
\li MorphingAnimation
\li VertexBlendAnimation
\endlist
*/
/*!
\qmlproperty real Qt3D.Animation::AbstractAnimation::position
Holds the current position of the animation.
*/
/*!
\qmlproperty real Qt3D.Animation::AbstractAnimation::duration
Holds the duration of the animation.
*/
QAbstractAnimationPrivate::QAbstractAnimationPrivate(QAbstractAnimation::AnimationType type)
: QObjectPrivate()
, m_animationType(type)
, m_position(0.0f)
, m_duration(0.0f)
{
}
QAbstractAnimation::QAbstractAnimation(QAbstractAnimationPrivate &dd, QObject *parent)
: QObject(dd, parent)
{
}
QString QAbstractAnimation::animationName() const
{
Q_D(const QAbstractAnimation);
return d->m_animationName;
}
QAbstractAnimation::AnimationType QAbstractAnimation::animationType() const
{
Q_D(const QAbstractAnimation);
return d->m_animationType;
}
float QAbstractAnimation::position() const
{
Q_D(const QAbstractAnimation);
return d->m_position;
}
float QAbstractAnimation::duration() const
{
Q_D(const QAbstractAnimation);
return d->m_duration;
}
void QAbstractAnimation::setAnimationName(const QString &name)
{
Q_D(QAbstractAnimation);
if (name != d->m_animationName) {
d->m_animationName = name;
emit animationNameChanged(name);
}
}
void QAbstractAnimation::setPosition(float position)
{
Q_D(QAbstractAnimation);
if (!qFuzzyCompare(position, d->m_position)) {
d->m_position = position;
emit positionChanged(position);
}
}
/*!
Sets the \a duration of the animation.
*/
void QAbstractAnimation::setDuration(float duration)
{
Q_D(QAbstractAnimation);
if (!qFuzzyCompare(duration, d->m_duration)) {
d->m_duration = duration;
emit durationChanged(duration);
}
}
} // Qt3DAnimation
QT_END_NAMESPACE
#include "moc_qabstractanimation.cpp"
|