diff options
author | Warwick Allison <warwick.allison@nokia.com> | 2010-01-11 11:48:44 +1000 |
---|---|---|
committer | Warwick Allison <warwick.allison@nokia.com> | 2010-01-11 11:48:44 +1000 |
commit | 71c73f80050fda96111122cc75676df60b51b0f5 (patch) | |
tree | f03e61575de75c0abbfcd1d80455694d7c3c554c /demos/declarative/snake/content/Cookie.qml | |
parent | 1f4d824286329887a65c777b59ae0289152c52a3 (diff) | |
download | qt4-tools-71c73f80050fda96111122cc75676df60b51b0f5.tar.gz |
Follow naming conventions (pass examples test)
Diffstat (limited to 'demos/declarative/snake/content/Cookie.qml')
-rw-r--r-- | demos/declarative/snake/content/Cookie.qml | 48 |
1 files changed, 48 insertions, 0 deletions
diff --git a/demos/declarative/snake/content/Cookie.qml b/demos/declarative/snake/content/Cookie.qml new file mode 100644 index 0000000000..7f0aadfe07 --- /dev/null +++ b/demos/declarative/snake/content/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/yellowStar.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 } + } + ] +} |