diff options
author | Martin Jones <martin.jones@nokia.com> | 2010-08-30 05:22:28 (GMT) |
---|---|---|
committer | Martin Jones <martin.jones@nokia.com> | 2010-08-30 05:22:28 (GMT) |
commit | 75fc8a8dd52156b2089764ce82925289877eee1d (patch) | |
tree | 608754856cf89c768e246f7405f24670d37ecad3 /demos/declarative/snake | |
parent | 7c81d90e490a95c67e0d0c9a184be479bd59817a (diff) | |
download | Qt-75fc8a8dd52156b2089764ce82925289877eee1d.zip Qt-75fc8a8dd52156b2089764ce82925289877eee1d.tar.gz Qt-75fc8a8dd52156b2089764ce82925289877eee1d.tar.bz2 |
Snake: Don't use Behavior with states.
Changing states mid-animation confuses states where property value
is not specified explicitly for each state.
Task-number: QT-3823
Diffstat (limited to 'demos/declarative/snake')
-rw-r--r-- | demos/declarative/snake/content/Cookie.qml | 6 | ||||
-rw-r--r-- | demos/declarative/snake/content/Link.qml | 8 | ||||
-rw-r--r-- | demos/declarative/snake/content/snake.js | 2 | ||||
-rw-r--r-- | demos/declarative/snake/snake.qml | 7 |
4 files changed, 18 insertions, 5 deletions
diff --git a/demos/declarative/snake/content/Cookie.qml b/demos/declarative/snake/content/Cookie.qml index e67a7af..eb57fd2 100644 --- a/demos/declarative/snake/content/Cookie.qml +++ b/demos/declarative/snake/content/Cookie.qml @@ -59,7 +59,6 @@ Item { anchors.fill: parent source: "pics/cookie.png" opacity: 0 - Behavior on opacity { NumberAnimation { duration: 100 } } Text { font.bold: true anchors.verticalCenter: parent.verticalCenter @@ -87,4 +86,9 @@ Item { PropertyChanges { target: img; opacity: 0 } } ] + transitions: [ + Transition { + NumberAnimation { target: img; property: "opacity"; duration: 100 } + } + ] } diff --git a/demos/declarative/snake/content/Link.qml b/demos/declarative/snake/content/Link.qml index 9aa6006..942008d 100644 --- a/demos/declarative/snake/content/Link.qml +++ b/demos/declarative/snake/content/Link.qml @@ -86,7 +86,6 @@ Item { id:link } opacity: 0 - Behavior on opacity { NumberAnimation { duration: 200 } } } @@ -114,4 +113,11 @@ Item { id:link PropertyChanges { target: img; opacity: 0 } } ] + + transitions: [ + Transition { + NumberAnimation { target: img; property: "opacity"; duration: 200 } + } + ] + } diff --git a/demos/declarative/snake/content/snake.js b/demos/declarative/snake/content/snake.js index fab7834..c2e9d3a 100644 --- a/demos/declarative/snake/content/snake.js +++ b/demos/declarative/snake/content/snake.js @@ -35,7 +35,7 @@ function startNewGame() if (heartbeat.running) { endGame(); startNewGameTimer.running = true; - state = "starting"; + state = ""; return; } diff --git a/demos/declarative/snake/snake.qml b/demos/declarative/snake/snake.qml index 12ad71c..cf037fc 100644 --- a/demos/declarative/snake/snake.qml +++ b/demos/declarative/snake/snake.qml @@ -106,7 +106,7 @@ Rectangle { anchors.fill: parent anchors.horizontalCenter: parent.horizontalCenter anchors.verticalCenter: parent.verticalCenter - Behavior on opacity { NumberAnimation { duration: 500 } } + onOpacityChanged: console.log("opacity: "+opacity); Text { color: "white" @@ -236,7 +236,10 @@ Rectangle { from: "*" to: "starting" NumberAnimation { target: progressIndicator; property: "width"; duration: 1000 } - + NumberAnimation { target: title; property: "opacity"; duration: 500 } + }, + Transition { + NumberAnimation { target: title; property: "opacity"; duration: 500 } } ] |