Qt Quick 3D - Robot Arm Example | Qt Quick 3D 6.4.3

- Qt 6.4
- Qt Quick 3D
- Qt Quick 3D Examples and Tutorials
- Qt Quick 3D - Robot Arm Example
- Qt Quick 3D | Commercial or GPLv3

# Qt Quick 3D - Robot Arm Example

     // Copyright (C) 2022 The Qt Company Ltd.
     // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause

     #include "animatedparam.h"

     #include <QVariantAnimation>

     AnimatedParam::AnimatedParam(QObject *parent) : QVariantAnimation(parent)
     {
         setDuration(1500);
         setEasingCurve(QEasingCurve::InOutCubic);

         connect(this, &QVariantAnimation::valueChanged, this, &AnimatedParam::valueChanged);
         connect(this, &QAbstractAnimation::stateChanged, this, [this](QAbstractAnimation::State newState, QAbstractAnimation::State oldState) {
             m_isRunning = (newState == QAbstractAnimation::Running);
         });
     }

     int AnimatedParam::value() const
     {
         return currentValue().toInt();
     }

     void AnimatedParam::setValue(int newValue)
     {
         stop();
         setStartValue(value());
         setEndValue(newValue);
         start();
     }

     bool AnimatedParam::isRunning() const
     {
         return m_isRunning;
     }