diff options
author | Alan Alpert <alan.alpert@nokia.com> | 2012-03-27 18:00:33 +1000 |
---|---|---|
committer | Qt by Nokia <qt-info@nokia.com> | 2012-03-28 05:49:28 +0200 |
commit | a3d4c97c5fb28599e007116fec679b16656df512 (patch) | |
tree | 811ae05f13d2b90dce878346ae2452dcf6b3934d /examples/qml/dynamicscene/content | |
parent | ed37dd9bb1f63d47a5daafc06af3a13549000f0c (diff) |
Reduce assumptions in examples
-dynamic scene, don't set duration on running animation (doesn't work)
-dynamic scene, just use set colors instead of system palette (in case
platform doesn't support it right, like N900)
-dynamic scene, calculator and shadereffects, don't rely on root item being
automatically in scope (possibly confusing)
Change-Id: I1eec018d5387424dc6b07bf51c1b2184b3048553
Reviewed-by: Yann Bodson <yann.bodson@nokia.com>
Diffstat (limited to 'examples/qml/dynamicscene/content')
-rw-r--r-- | examples/qml/dynamicscene/content/Button.qml | 7 | ||||
-rw-r--r-- | examples/qml/dynamicscene/content/Sun.qml | 35 |
2 files changed, 17 insertions, 25 deletions
diff --git a/examples/qml/dynamicscene/content/Button.qml b/examples/qml/dynamicscene/content/Button.qml index 014692274a..ba7db501cc 100644 --- a/examples/qml/dynamicscene/content/Button.qml +++ b/examples/qml/dynamicscene/content/Button.qml @@ -54,16 +54,14 @@ Rectangle { gradient: Gradient { GradientStop { position: 0.0 - color: !mouseArea.pressed ? activePalette.light : activePalette.button + color: !mouseArea.pressed ? "#eeeeee" : "#888888" } GradientStop { position: 1.0 - color: !mouseArea.pressed ? activePalette.button : activePalette.dark + color: !mouseArea.pressed ? "#888888" : "#333333" } } - SystemPalette { id: activePalette } - MouseArea { id: mouseArea anchors.fill: parent @@ -75,6 +73,5 @@ Rectangle { anchors.centerIn:parent font.pointSize: 10 text: parent.text - color: activePalette.buttonText } } diff --git a/examples/qml/dynamicscene/content/Sun.qml b/examples/qml/dynamicscene/content/Sun.qml index b84516eecc..9a956c9855 100644 --- a/examples/qml/dynamicscene/content/Sun.qml +++ b/examples/qml/dynamicscene/content/Sun.qml @@ -47,32 +47,27 @@ Image { property string image: "images/sun.png" source: image - - // once item is created, start moving offscreen - NumberAnimation on y { - to: (window.height / 2) + window.centerOffset - running: created - onRunningChanged: { - if (running) - duration = (window.height + window.centerOffset - sun.y) * 10; - else - state = "OffScreen" - } - } - - states: State { - name: "OffScreen" - StateChangeScript { - script: { sun.created = false; sun.destroy() } - } - } - onCreatedChanged: { if (created) { sun.z = 1; // above the sky but below the ground layer window.activeSuns++; + // once item is created, start moving offscreen + dropYAnim.duration = (window.height + window.centerOffset - sun.y) * 16; + dropAnim.running = true; } else { window.activeSuns--; } } + + SequentialAnimation on y{ + id: dropAnim + running: false + NumberAnimation { + id: dropYAnim + to: (window.height / 2) + window.centerOffset + } + ScriptAction { + script: { sun.created = false; sun.destroy() } + } + } } |