summaryrefslogtreecommitdiffstats
path: root/CoffeeTweed/Cup.qml
diff options
context:
space:
mode:
Diffstat (limited to 'CoffeeTweed/Cup.qml')
-rw-r--r--CoffeeTweed/Cup.qml112
1 files changed, 112 insertions, 0 deletions
diff --git a/CoffeeTweed/Cup.qml b/CoffeeTweed/Cup.qml
new file mode 100644
index 0000000..93fc385
--- /dev/null
+++ b/CoffeeTweed/Cup.qml
@@ -0,0 +1,112 @@
+import Qt 4.7
+
+Item {
+ id: coffee_cup
+ width: 190; height: 480
+
+ function return_to_ashes() {
+ coffee_cup.state = "";
+ }
+
+ Image {
+ id: cup_plate
+ source: "images/coffee_plate.png"; y: 365
+ }
+
+ Item {
+ id: cup_full
+ width: 135; height: 138; x: 7; y: 280
+ Image { source: "images/cup_back.png"; }
+
+ Item { id: cup_content; Image { source: "images/cup_content.png"; } }
+ Item { id: cup_front; Image { source: "images/cup_front.png"; } }
+ }
+
+ Item {
+ id: cup_empty
+ width: 135; height: 138; x: 7; y: 280; opacity: 0
+ Image { source: "images/cup_empty.png"; }
+ }
+
+ Item {
+ id: cup_smoke
+ width: 233; height: 258; y: 45; x: -13; opacity: 1
+ Image { source: "images/cup_smoke.png" }
+ }
+
+ Item {
+ id: cup_running
+ width: 135; height: 188; x: 7; y: -228; opacity: 0
+ Image { source: "images/cup_blur.png"; }
+ }
+
+ states: [
+ State{
+ name: "less_one"
+ }
+ ]
+
+ transitions: [
+ Transition {
+ from: ""
+ to: "less_one"
+
+ SequentialAnimation{
+
+ // Empty the cup and fade the smoke
+ ParallelAnimation {
+ PropertyAnimation { target: cup_smoke; property: "opacity"; to: 0; duration: 500; }
+ PropertyAnimation { target: cup_content; property: "y"; to: 25; duration: 500; }
+ }
+
+ // Change the full cup composition by the empty cup
+ PropertyAction { target: cup_empty; property: "opacity"; value: 1 }
+ PropertyAction { target: cup_full; property: "opacity"; value: 0; }
+
+ // Pause for coffee
+ PauseAnimation { duration: 100; }
+
+ // Fade out the empty cup
+ PropertyAnimation { target: cup_empty; property: "opacity"; to: 0; duration: 200; }
+
+ // Send the empty cup to the top and update the number
+ PropertyAction { target: cup_empty; property: "y"; value: -188; }
+
+ // Turn on the blur and empty cups
+ PropertyAction { target: cup_running; property: "opacity"; value: 1; }
+ PropertyAction { target: cup_empty; property: "opacity"; value: 1; }
+
+ // Clean cup coming!
+ ParallelAnimation {
+ PropertyAnimation { target: cup_running; property: "y"; to: 235; duration: 300; }
+ PropertyAnimation { target: cup_empty; property: "y"; to: 285; duration: 300; }
+ }
+
+ // Landing in the plate
+ ParallelAnimation {
+ PropertyAnimation { target: cup_empty; property: "y"; to: 280; duration: 150; }
+ PropertyAnimation { target: cup_running; property: "opacity"; to: 0; duration: 200; }
+ }
+
+ // Get the blured cup to the original place
+ PropertyAction { target: cup_running; property: "y"; value: -228; }
+
+ // Wait for the waiter
+ PauseAnimation { duration: 500; }
+
+ // Change the empty cup by the full cup composition
+ PropertyAction { target: cup_full; property: "opacity"; value: 1; }
+ PropertyAction { target: cup_empty; property: "opacity"; value: 0; }
+
+ // Here is your coffee, sir
+ PropertyAnimation { target: cup_content; property: "y"; to: 0; duration: 400; }
+ PropertyAnimation { target: cup_smoke; property: "opacity"; to: 1; duration: 700; }
+
+ // Ready for the next turn
+ ScriptAction { script: return_to_ashes() }
+ }
+
+ }
+ ]
+
+}