summaryrefslogtreecommitdiffstats
path: root/src/declarative/util/qdeclarativeanimation_p.h
diff options
context:
space:
mode:
authorLeonardo Sobral Cunha <leo.cunha@nokia.com>2010-02-12 07:19:51 (GMT)
committerLeonardo Sobral Cunha <leo.cunha@nokia.com>2010-03-30 03:54:12 (GMT)
commit7a060ca401b4e260fd08c854213024b050a67ff2 (patch)
tree50745dec7be82136622ae0ccaa0430caa8e0d5a8 /src/declarative/util/qdeclarativeanimation_p.h
parent68d3e2da7719ff0fc230e8204946b27018e42c14 (diff)
downloadQt-7a060ca401b4e260fd08c854213024b050a67ff2.zip
Qt-7a060ca401b4e260fd08c854213024b050a67ff2.tar.gz
Qt-7a060ca401b4e260fd08c854213024b050a67ff2.tar.bz2
Change and rename qml EaseFollow to SmoothedAnimation
QDeclarativeSmoothedAnimation inherits from QDeclarativeNumberAnimation, as a consequence SmoothedAnimation can be used inside Behaviors and as PropertySourceValues, like any other animation. The old EaseFollow properties changed to comply with the other declarative animations ('source' changed to 'to'), so now 'to' changes are not automatically 'followed' anymore. You can achieve the following behavior by putting a SmoothedAnimation inside a Behavior of a property that is bound to another, as the following example: If you want to follow an hypothetical rect1, you should do now: Rectangle { color: "green" width: 60; height: 60; x: rect1.x - 5; y: rect1.y - 5; Behavior on x { SmoothedAnimation { velocity: 200 } } Behavior on y { SmoothedAnimation { velocity: 200 } } } SmoothedAnimation also supports animating multiple target(s)/property(ies) in the transition case. When a QDeclarativeSmoothedAnimation is restarted, it will match the QDeclarativeProperty which were being animated and transfer the corresponding track velocity to the new starting animations. QSmoothedAnimation is an uncontrolled animation, duration == -1. The duration is set as -1 to avoid consecutive animation state changes stop()/start(). This is particularly useful when using QSmoothAnimation to 'follow' another property, which is also being animated (change the 'to' property every tick). Reviewed-by: Michael Brasser
Diffstat (limited to 'src/declarative/util/qdeclarativeanimation_p.h')
-rw-r--r--src/declarative/util/qdeclarativeanimation_p.h10
1 files changed, 8 insertions, 2 deletions
diff --git a/src/declarative/util/qdeclarativeanimation_p.h b/src/declarative/util/qdeclarativeanimation_p.h
index 816520e..f620786 100644
--- a/src/declarative/util/qdeclarativeanimation_p.h
+++ b/src/declarative/util/qdeclarativeanimation_p.h
@@ -251,8 +251,8 @@ public:
QDeclarativePropertyAnimation(QObject *parent=0);
virtual ~QDeclarativePropertyAnimation();
- int duration() const;
- void setDuration(int);
+ virtual int duration() const;
+ virtual void setDuration(int);
QVariant from() const;
void setFrom(const QVariant &);
@@ -326,6 +326,12 @@ public:
qreal to() const;
void setTo(qreal);
+
+protected:
+ QDeclarativeNumberAnimation(QDeclarativePropertyAnimationPrivate &dd, QObject *parent);
+
+private:
+ void init();
};
class Q_AUTOTEST_EXPORT QDeclarativeVector3dAnimation : public QDeclarativePropertyAnimation