also be treated as an Animator and be run on the scene graph's rendering
thread when possible.
+ The Animator types can be used for animations during transitions, but
+ they do not support the \l {Transition::reversible}{reversible}
+ property.
+
The Animator type cannot be used directly in a QML file. It exists
to provide a set of common properties and methods, available across all the
other animator types that inherit from it. Attempting to use the Animator
QAbstractAnimationJob *QQuickAnimator::transition(QQuickStateActions &actions,
QQmlProperties &modified,
- TransitionDirection,
+ TransitionDirection direction,
QObject *)
{
Q_D(QQuickAnimator);
return 0;
}
+ // The animation system cannot handle backwards uncontrolled animations.
+ if (direction == Backward)
+ return 0;
+
QQuickAnimatorJob *job = createJob();
if (!job)
return 0;
{
if (job->isRenderThreadJob()) {
QQuickAnimatorJob *a = static_cast<QQuickAnimatorJob *>(job);
- if (a->controller())
+ // Sync back only those jobs that actually have been running
+ if (a->controller() && a->hasBeenRunning())
a->writeBack();
} else if (job->isGroup()) {
QAnimationGroupJob *g = static_cast<QAnimationGroupJob *>(job);
, m_duration(0)
, m_isTransform(false)
, m_isUniform(false)
+ , m_hasBeenRunning(false)
{
m_isRenderThreadJob = true;
}
if (newState == Running) {
m_controller->activeLeafAnimations << this;
+ m_hasBeenRunning = true;
} else if (oldState == Running) {
m_controller->activeLeafAnimations.remove(this);
}
QObject::connect(m_target, SIGNAL(destroyed(QObject *)), m_controller, SLOT(itemDestroyed(QObject*)), Qt::DirectConnection);
} else {
++m_helper->ref;
+ // Make sure leftovers from previous runs are being used...
+ m_helper->wasSynced = false;
}
m_helper->sync();
}
switch (m_direction) {
case QQuickRotationAnimator::Clockwise:
m_value = _q_interpolateClockwiseRotation(m_from, m_to, t).toFloat();
+ // The logic in _q_interpolateClockwise comes out a bit wrong
+ // for the case of X->0 where 0<X<360. It ends on 360 which it
+ // shouldn't.
+ if (t == 1)
+ m_value = m_to;
break;
case QQuickRotationAnimator::Counterclockwise:
m_value = _q_interpolateCounterclockwiseRotation(m_from, m_to, t).toFloat();
bool isTransform() const { return m_isTransform; }
bool isUniform() const { return m_isUniform; }
+ bool hasBeenRunning() const { return m_hasBeenRunning; }
+
qreal value() const;
QQuickAnimatorController *controller() const { return m_controller; }
uint m_feedback : 1;
uint m_isTransform : 1;
uint m_isUniform : 1;
+ uint m_hasBeenRunning : 1;
};
class QQuickTransformAnimatorJob : public QQuickAnimatorJob