diff options
Diffstat (limited to 'src/declarative/util/qmlanimation.cpp')
-rw-r--r-- | src/declarative/util/qmlanimation.cpp | 78 |
1 files changed, 37 insertions, 41 deletions
diff --git a/src/declarative/util/qmlanimation.cpp b/src/declarative/util/qmlanimation.cpp index 4bcc550..d5765c1 100644 --- a/src/declarative/util/qmlanimation.cpp +++ b/src/declarative/util/qmlanimation.cpp @@ -177,12 +177,14 @@ QmlAbstractAnimation::QmlAbstractAnimation(QmlAbstractAnimationPrivate &dd, QObj whenever the \l MouseRegion is pressed. \code - <Rect width="100" height="100"> - <x> - <NumericAnimation running="{MyMouse.pressed}" from="0" to="100" /> - </x> - <MouseRegion id="MyMouse" /> - </Rect> + Rect { + width: 100; height: 100 + x: NumericAnimation { + running: MyMouse.pressed + from: 0; to: 100 + } + MouseRegion { id: MyMouse } + } \endcode Likewise, the \c running property can be read to determine if the animation @@ -190,8 +192,8 @@ QmlAbstractAnimation::QmlAbstractAnimation(QmlAbstractAnimationPrivate &dd, QObj or not the animation is running. \code - <NumericAnimation id="MyAnimation" /> - <Text text="{MyAnimation.running?'Animation is running':'Animation is not running'}" /> + NumericAnimation { id: MyAnimation } + Text { text: MyAnimation.running ? "Animation is running" : "Animation is not running" } \endcode Animations can also be started and stopped imperatively from JavaScript @@ -304,11 +306,9 @@ void QmlAbstractAnimation::setFinishPlaying(bool f) In the following example, the rectangle will spin indefinately. \code - <Rect> - <rotation> - <NumericAnimation running="true" repeat="true" from="0" to="360" /> - </rotation> - </Rect> + Rect { + rotation: NumericAnimation { running: true; repeat: true; from: 0 to: 360 } + } \endcode */ bool QmlAbstractAnimation::repeat() const @@ -435,11 +435,9 @@ void QmlAbstractAnimation::start() Normally \c stop() stops the animation immediately, and the animation has no further influence on property values. In this example animation \code - <Rect> - <x> - <NumericAnimation from="0" to="100" duration="500" /> - </x> - </Rect> + Rect { + x: NumericAnimation { from: 0; to: 100; duration: 500 } + } \endcode was stopped at time 250ms, the \c x property will have a value of 50. @@ -475,11 +473,9 @@ void QmlAbstractAnimation::restart() Unlike \c stop(), \c complete() immediately fast-forwards the animation to its end. In the following example, \code - <Rect> - <x> - <NumericAnimation from="0" to="100" duration="500" /> - </x> - </Rect> + Rect { + x: NumericAnimation { from: 0; to: 100; duration: 500 } + } \endcode calling \c stop() at time 250ms will result in the \c x property having a value of 50, while calling \c complete() will set the \c x property to @@ -529,11 +525,11 @@ void QmlAbstractAnimation::timelineComplete() A 500ms animation sequence, with a 100ms pause between two animations: \code - <SequentialAnimation> - <NumericAnimation ... duration="200"/> - <PauseAnimation duration="100"/> - <NumericAnimation ... duration="200"/> - </SequentialAnimation> + SequentialAnimation { + NumericAnimation { ... duration: 200 } + PauseAnimation { duration: 100 } + NumericAnimation { ... duration: 200 } + } \endcode */ /*! @@ -621,7 +617,7 @@ QAbstractAnimation *QmlPauseAnimation::qtAnimation() \brief The ColorAnimation allows you to animate color changes. \code - <ColorAnimation from="white" to="#c0c0c0" duration="100"/> + ColorAnimation { from: "white" to: "#c0c0c0"; duration: 100 } \endcode The default property animated is \c color, but like other animations, @@ -1016,12 +1012,12 @@ QML_DEFINE_TYPE(QmlRunScriptAction, RunScriptAction); Explicitly set \c theimage.smooth=true during a transition: \code - <SetPropertyAction target="{theimage}" property="smooth" value="true"/> + SetPropertyAction { target: theimage; property: "smooth"; value: true } \endcode Set \c thewebview.url to the value set for the destination state: \code - <SetPropertyAction target="{thewebview}" property="url"/> + SetPropertyAction { target: thewebview; property: "url" } \endcode The SetPropertyAction is immediate - @@ -1324,7 +1320,7 @@ QML_DEFINE_TYPE(QmlParentChangeAction,ParentChangeAction); Animate a set of properties over 200ms, from their values in the start state to their values in the end state of the transition: \code - <NumericAnimation properties="x,y,scale" duration="200"/> + NumericAnimation { properties: "x,y,scale"; duration: 200 } \endcode */ @@ -1723,10 +1719,10 @@ QmlList<QmlAbstractAnimation *> *QmlAnimationGroup::animations() object will animate from its current x position to 100, and then back to 0. \code - <SequentialAnimation> - <NumericAnimation target="{MyItem}" property="x" to="100" /> - <NumericAnimation target="{MyItem}" property="x" to="0" /> - <SequentialAnimation> + SequentialAnimation { + NumericAnimation { target: MyItem; property: "x"; to: 100 } + NumericAnimation { target: MyItem; property: "x"; to: 0 } + } \endcode \sa ParallelAnimation @@ -1800,10 +1796,10 @@ QML_DEFINE_TYPE(QmlSequentialAnimation,SequentialAnimation); to (100,100) by animating the x and y properties in parallel. \code - <ParallelAnimation> - <NumericAnimation target="{MyItem}" property="x" to="100" /> - <NumericAnimation target="{MyItem}" property="y" to="100" /> - </ParallelAnimation> + ParallelAnimation { + NumericAnimation { target: MyItem; property: "x"; to: 100 } + NumericAnimation { target: MyItem; property: "y"; to: 100 } + } \endcode \sa SequentialAnimation @@ -1924,7 +1920,7 @@ void QmlVariantAnimationPrivate::convertVariant(QVariant &variant, QVariant::Typ Animate a size property over 200ms, from its current size to 20-by-20: \code - <VariantAnimation property="size" to="20x20" duration="200"/> + VariantAnimation { property: "size"; to: "20x20"; duration: 200 } \endcode */ |