aboutsummaryrefslogtreecommitdiffstats
path: root/examples/qml/dynamicscene/content/Sun.qml
diff options
context:
space:
mode:
Diffstat (limited to 'examples/qml/dynamicscene/content/Sun.qml')
-rw-r--r--examples/qml/dynamicscene/content/Sun.qml35
1 files changed, 15 insertions, 20 deletions
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() }
+ }
+ }
}