Qt Quick 3D - Robot Arm Example
#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