8#include "private/qcontinuinganimationgroupjob_p.h"
12#include <private/qqmlproperty_p.h>
14#include <private/qqmlglobal_p.h>
16#include <QtCore/qdebug.h>
19#define DELAY_STOP_TIMER_INTERVAL 32
43 trackVelocity(0), initialValue(0),
invert(
false), finalDuration(-1), lastTime(0),
52 delete delayedStopTimer;
53 if (animationTemplate) {
61 if (
it.value() ==
this) {
99void QSmoothedAnimation::delayedStop()
102 delayedStopTimer->
start();
110bool QSmoothedAnimation::recalc()
112 s =
to - initialValue;
128 finalDuration =
qCeil(tf * 1000.0);
149 a = (
s - (vi * tf - 0.5 * vi * ta)) / (tf * ta - ta * ta);
154 sp = vi * ta + 0.5 *
a * tp * tp;
155 sd = sp + vp * (tf - 2 * ta);
158 qreal c1 = 0.25 * tf * tf;
160 qreal c3 = -0.25 * vi * vi;
164 qreal tp1 = 0.5 * tf - 0.5 * vi /
a1;
167 qreal sp1 = 0.5 *
a1 * tp1 * tp1 + vi * tp1;
180qreal QSmoothedAnimation::easeFollow(
qreal time_seconds)
183 if (time_seconds < tp) {
185 value = 0.5 *
a * time_seconds * time_seconds + vi * time_seconds;
186 }
else if (time_seconds < td) {
189 value = sp + time_seconds * vp;
190 }
else if (time_seconds < tf) {
193 value = sd - 0.5 * d * time_seconds * time_seconds + vp * time_seconds;
231 delayedStopTimer->
stop();
233 initialValue =
target.read().toReal();
236 if (
to == initialValue) {
242 ((!
invert) == ((initialValue -
to) > 0));
347 it.value()->clearTemplate();
373 if (!dataActions.isEmpty()) {
374 QSet<QAbstractAnimationJob*> anims;
375 for (
int i = 0;
i < dataActions.size();
i++) {
378 if (!
d->activeAnimations.contains(dataActions[
i].property)) {
380 d->activeAnimations.insert(dataActions[
i].
property, ease);
381 ease->target = dataActions[
i].property;
384 ease =
d->activeAnimations.value(dataActions[
i].
property);
389 ease->to = dataActions[
i].toValue.toReal();
392 ease->maximumEasingTime =
d->anim->maximumEasingTime;
393 ease->reversingMode =
d->anim->reversingMode;
394 ease->velocity =
d->anim->velocity;
395 ease->userDuration =
d->anim->userDuration;
397 ease->initialVelocity = ease->trackVelocity;
400 ease->prepareForRestart();
404 const auto copy =
d->activeAnimations;
406 if (!anims.contains(ease)) {
407 ease->clearTemplate();
408 d->activeAnimations.remove(ease->target);
438 if (
d->anim->reversingMode ==
m)
441 d->anim->reversingMode =
m;
443 d->updateRunningAnimations();
459 return d->anim->userDuration;
470 d->updateRunningAnimations();
476 return d->anim->velocity;
494 if (
d->anim->velocity ==
v)
497 d->anim->velocity =
v;
499 d->updateRunningAnimations();
515 return d->anim->maximumEasingTime;
521 if(
v ==
d->anim->maximumEasingTime)
523 d->anim->maximumEasingTime =
v;
525 d->updateRunningAnimations();
530#include "moc_qquicksmoothedanimation_p_p.cpp"
532#include "moc_qquicksmoothedanimation_p.cpp"
iterator begin()
Returns an \l{STL-style iterators}{STL-style iterator} pointing to the first item in the hash.
const_iterator cbegin() const noexcept
const_iterator constFind(const Key &key) const noexcept
iterator erase(const_iterator it)
iterator end() noexcept
Returns an \l{STL-style iterators}{STL-style iterator} pointing to the imaginary item after the last ...
const_iterator cend() const noexcept
static QMetaObject::Connection connect(const QObject *sender, const char *signal, const QObject *receiver, const char *member, Qt::ConnectionType=Qt::AutoConnection)
\threadsafe
static bool write(QObject *, const QQmlPropertyData &, const QVariant &, const QQmlRefPointer< QQmlContextData > &, QQmlPropertyData::WriteFlags flags={})
QAbstractAnimationJob * initInstance(QAbstractAnimationJob *animation)
virtual void setDuration(int)
QQuickStateActions createTransitionActions(QQuickStateActions &actions, QQmlProperties &modified, QObject *defaultTarget=nullptr)
QHash< QQmlProperty, QSmoothedAnimation * > activeAnimations
QQuickSmoothedAnimationPrivate()
QSmoothedAnimation * anim
~QQuickSmoothedAnimationPrivate()
void updateRunningAnimations()
int duration() const override
\qmlproperty int QtQuick::SmoothedAnimation::duration
void setReversingMode(ReversingMode)
void maximumEasingTimeChanged()
QAbstractAnimationJob * transition(QQuickStateActions &actions, QQmlProperties &modified, TransitionDirection direction, QObject *defaultTarget=nullptr) override
void setDuration(int) override
ReversingMode reversingMode
void reversingModeChanged()
QQuickSmoothedAnimation(QObject *parent=nullptr)
\qmltype SmoothedAnimation \instantiates QQuickSmoothedAnimation \inqmlmodule QtQuick\inherits Number...
void setVelocity(qreal)
\qmlproperty real QtQuick::SmoothedAnimation::velocity
void setMaximumEasingTime(int)
QSmoothedAnimationTimer(QSmoothedAnimation *animation, QObject *parent=nullptr)
~QSmoothedAnimationTimer()
void updateState(QAbstractAnimationJob::State, QAbstractAnimationJob::State) override
void updateCurrentTime(int) override
void debugAnimation(QDebug d) const override
QQuickSmoothedAnimation::ReversingMode reversingMode
QSmoothedAnimation(QQuickSmoothedAnimationPrivate *=nullptr)
int duration() const override
void setSingleShot(bool singleShot)
void start(int msec)
Starts or restarts the timer with a timeout interval of msec milliseconds.
void setInterval(int msec)
bool isActive() const
Returns true if the timer is running (pending); otherwise returns false.
void stop()
Stops the timer.
QSet< QString >::iterator it
void newState(QList< State > &states, const char *token, const char *lexem, bool pre)
Combined button and popup list for selecting options.
QTextStream & hex(QTextStream &stream)
Calls QTextStream::setIntegerBase(16) on stream and returns stream.
QTextStream & dec(QTextStream &stream)
Calls QTextStream::setIntegerBase(10) on stream and returns stream.
static jboolean copy(JNIEnv *, jobject)
EGLOutputLayerEXT EGLint EGLAttrib value
[5]
qfloat16 qSqrt(qfloat16 f)
GLsizei const GLfloat * v
[13]
GLboolean GLboolean GLboolean GLboolean a
[7]
GLbitfield GLuint64 timeout
[4]
#define DELAY_STOP_TIMER_INTERVAL