diff options
author | Bea Lam <bea.lam@nokia.com> | 2010-05-18 07:43:20 (GMT) |
---|---|---|
committer | Bea Lam <bea.lam@nokia.com> | 2010-05-18 07:45:10 (GMT) |
commit | f4492bf01baae353ff63da18a9a602fb3a8058e4 (patch) | |
tree | dd26f922483ad4905cb2b0b38d2b9097dbf6178c /examples/declarative/toys/dynamicscene/qml/Sun.qml | |
parent | ba9218a9786abddd461034b5aeb1d5a39f8072f9 (diff) | |
download | Qt-f4492bf01baae353ff63da18a9a602fb3a8058e4.zip Qt-f4492bf01baae353ff63da18a9a602fb3a8058e4.tar.gz Qt-f4492bf01baae353ff63da18a9a602fb3a8058e4.tar.bz2 |
Rename some examples: proxyviewer -> networkaccessmanagerfactory,
proxywidgets -> qwidgets, dynamic -> dynamicscene, velocity -> corkboards
Diffstat (limited to 'examples/declarative/toys/dynamicscene/qml/Sun.qml')
-rw-r--r-- | examples/declarative/toys/dynamicscene/qml/Sun.qml | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/examples/declarative/toys/dynamicscene/qml/Sun.qml b/examples/declarative/toys/dynamicscene/qml/Sun.qml new file mode 100644 index 0000000..43dcb9a --- /dev/null +++ b/examples/declarative/toys/dynamicscene/qml/Sun.qml @@ -0,0 +1,38 @@ +import Qt 4.7 + +Image { + id: sun + + property bool created: false + property string image: "../images/sun.png" + + source: image + + // once item is created, start moving offscreen + NumberAnimation on y { + to: window.height / 2 + running: created + onRunningChanged: { + if (running) + duration = (window.height - 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++; + } else { + window.activeSuns--; + } + } +} |