diff options
author | mae <qt-info@nokia.com> | 2009-11-25 11:04:25 (GMT) |
---|---|---|
committer | mae <qt-info@nokia.com> | 2009-11-25 11:04:55 (GMT) |
commit | 10d689d226d5d221e8c6bc34ce0e0af4ed5b73d6 (patch) | |
tree | e8bcb82a5d9abe21354f8187944ce7c71bee4566 /demos/declarative/snake/Cookie.qml | |
parent | 4c7df87f77c1bfda4290f729dd2ed993eadb5362 (diff) | |
download | Qt-10d689d226d5d221e8c6bc34ce0e0af4ed5b73d6.zip Qt-10d689d226d5d221e8c6bc34ce0e0af4ed5b73d6.tar.gz Qt-10d689d226d5d221e8c6bc34ce0e0af4ed5b73d6.tar.bz2 |
added a snake demo
Diffstat (limited to 'demos/declarative/snake/Cookie.qml')
-rw-r--r-- | demos/declarative/snake/Cookie.qml | 48 |
1 files changed, 48 insertions, 0 deletions
diff --git a/demos/declarative/snake/Cookie.qml b/demos/declarative/snake/Cookie.qml new file mode 100644 index 0000000..d1577ca --- /dev/null +++ b/demos/declarative/snake/Cookie.qml @@ -0,0 +1,48 @@ +import Qt 4.6 + +Item { + id: root + property bool dying: false + property int row; + property int column; + x: margin + column * gridSize + y: margin + row * gridSize + + width: gridSize + height: gridSize + property int value : 1; + + Image { + id: img + anchors.fill: parent + source: "pics/cookie.png" + opacity: 0 + opacity: Behavior { NumberAnimation { duration: 100 } } + Text { + font.bold: true + anchors.verticalCenter: parent.verticalCenter + anchors.horizontalCenter: parent.horizontalCenter + text: value + } + } + + + Particles { id: particles + width:1; height:1; anchors.centerIn: parent; + emissionRate: 0; + lifeSpan: 700; lifeSpanDeviation: 600; + angle: 0; angleDeviation: 360; + velocity: 100; velocityDeviation:30; + source: "pics/greenStar.png"; + } + + states: [ + State{ name: "AliveState"; when: dying == false + PropertyChanges { target: img; opacity: 1 } + }, + State{ name: "DeathState"; when: dying == true + StateChangeScript { script: particles.burst(50); } + PropertyChanges { target: img; opacity: 0 } + } + ] +} |