1// Copyright (C) 2017 Klaralvdalens Datakonsult AB (KDAB).
2// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
3
4#include "qclock.h"
5#include "qclock_p.h"
6
7QT_BEGIN_NAMESPACE
8
9namespace Qt3DAnimation {
10
11QClockPrivate::QClockPrivate()
12 : Qt3DCore::QNodePrivate()
13 , m_playbackRate(1.0f)
14{
15}
16
17QClock::QClock(Qt3DCore::QNode* parent)
18 : Qt3DCore::QNode(*new QClockPrivate, parent)
19{
20}
21
22QClock::QClock(QClockPrivate &dd, Qt3DCore::QNode *parent)
23 : Qt3DCore::QNode(dd, parent)
24{
25}
26
27QClock::~QClock()
28{
29}
30/*!
31 \property Qt3DAnimation::QClock::playbackRate
32
33 The playback speed of the animation. The playback speed can be negative.
34 When that is the case the animation will be played back from the current
35 normalized time value back to 0 and for the number of loops it had been
36 played for with a positive playback rate.
37*/
38
39double QClock::playbackRate() const
40{
41 Q_D(const QClock);
42 return d->m_playbackRate;
43}
44
45void QClock::setPlaybackRate(double playbackRate)
46{
47 Q_D(QClock);
48 if (qFuzzyCompare(p1: playbackRate, p2: d->m_playbackRate))
49 return;
50 d->m_playbackRate = playbackRate;
51 emit playbackRateChanged(playbackRate);
52}
53
54}
55
56QT_END_NAMESPACE
57
58#include "moc_qclock.cpp"
59

source code of qt3d/src/animation/frontend/qclock.cpp