diff options
author | Martin Jones <martin.jones@nokia.com> | 2010-03-16 05:49:27 (GMT) |
---|---|---|
committer | Martin Jones <martin.jones@nokia.com> | 2010-03-16 05:49:27 (GMT) |
commit | a32cd00668076674b6968b821d4b7377c95ddee9 (patch) | |
tree | 6b8e7f83a5b5e5c1bd0106faf6b465d3f9fc3132 /doc | |
parent | 31e06818aaf65150f61107f112b305cfd8585710 (diff) | |
download | Qt-a32cd00668076674b6968b821d4b7377c95ddee9.zip Qt-a32cd00668076674b6968b821d4b7377c95ddee9.tar.gz Qt-a32cd00668076674b6968b821d4b7377c95ddee9.tar.bz2 |
Update more animation on property value source docs.
Diffstat (limited to 'doc')
-rw-r--r-- | doc/src/declarative/animation.qdoc | 9 | ||||
-rw-r--r-- | doc/src/declarative/dynamicobjects.qdoc | 25 |
2 files changed, 18 insertions, 16 deletions
diff --git a/doc/src/declarative/animation.qdoc b/doc/src/declarative/animation.qdoc index 2b75211..7e0a787 100644 --- a/doc/src/declarative/animation.qdoc +++ b/doc/src/declarative/animation.qdoc @@ -58,7 +58,8 @@ types listed above. If the property you are animating is a number or color, you NumberAnimation or ColorAnimation. These elements don't add any additional functionality, but will help enforce type correctness and are slightly more efficient. -A property animation can be specified as a value source. This is especially useful for repeating animations. +A property animation can be specified as a value source using the \e Animation \bold on \e property syntax. This is especially useful +for repeating animations. The following example creates a bouncing effect: \qml @@ -70,7 +71,7 @@ Rectangle { source: "qt-logo.png" x: 60-img.width/2 y: 0 - y: SequentialAnimation { + SequentialAnimation on y { repeat: true NumberAnimation { to: 200-img.height; easing.type: "OutBounce"; duration: 2000 } PauseAnimation { duration: 1000 } @@ -93,7 +94,7 @@ Rectangle { Rectangle { color: "red" width: 50; height: 50 - x: NumberAnimation { to: 50; } + NumberAnimation on x { to: 50; } } } \endqml @@ -226,7 +227,7 @@ Rectangle { id: redRect color: "red" width: 100; height: 100 - x: Behavior { NumberAnimation { duration: 300; easing.type: "InOutQuad" } } + Behavior on x { NumberAnimation { duration: 300; easing.type: "InOutQuad" } } } \endqml diff --git a/doc/src/declarative/dynamicobjects.qdoc b/doc/src/declarative/dynamicobjects.qdoc index 033c0d1..b2e3f90 100644 --- a/doc/src/declarative/dynamicobjects.qdoc +++ b/doc/src/declarative/dynamicobjects.qdoc @@ -76,25 +76,25 @@ the component. Example QML script is below. Remember that QML files that might b \code var component; var sprite; - function finishCreation(){ - if(component.isReady()){ + function finishCreation() { + if(component.isReady()) { sprite = component.createObject(); - if(sprite == 0){ + if(sprite == 0) { // Error Handling - }else{ + } else { sprite.parent = page; sprite.x = 200; //... } - }else if(component.isError()){ + } else if(component.isError()) { // Error Handling } } component = createComponent("Sprite.qml"); - if(component.isReady()){ + if(component.isReady()) { finishCreation(); - }else{ + } else { component.statusChanged.connect(finishCreation); } \endcode @@ -104,10 +104,10 @@ the component. Example QML script is below. Remember that QML files that might b \code component = createComponent("Sprite.qml"); sprite = component.createObject(); - if(sprite == 0){ + if(sprite == 0) { // Error Handling console.log(component.errorsString()); - }else{ + } else { sprite.parent = page; sprite.x = 200; //... @@ -122,7 +122,7 @@ If the QML does not exist until runtime, you can create a QML item from a string of QML using the createQmlObject function, as in the following example: \code - newObject = createQmlObject('import Qt 4.6; Rectangle {color: "red"; width: 20; height: 20}', + newObject = createQmlObject('import Qt 4.6; Rectangle { color: "red"; width: 20; height: 20 }', targetItem, "dynamicSnippet1"); \endcode The first argument is the string of QML to create. Just like in a new file, you will need to @@ -158,11 +158,12 @@ argument, which is an approximate delay in ms and which defaults to zero. This allows you to wait until the completion of an animation or transition. An example: \code - Component{ id:fadesOut + Component { + id: fadesOut Rectangle{ id: rect width: 40; height: 40; - opacity: NumberAnimation{from:1; to:0; duration: 1000;} + NumberAnimation on opacity { from:1; to:0; duration: 1000 } Component.onCompleted: rect.destroy(1000); } } |