equal
deleted
inserted
replaced
|
1 import Qt 4.7 |
|
2 |
|
3 Rectangle { |
|
4 width: 400; height: 240 |
|
5 color: "white" |
|
6 |
|
7 Timer { |
|
8 interval: 3000; running: true; repeat: true; triggeredOnStart: true |
|
9 onTriggered: { |
|
10 if (flipable.state == '') flipable.state = 'back'; else flipable.state = '' |
|
11 if (flipable2.state == '') flipable2.state = 'back'; else flipable2.state = '' |
|
12 } |
|
13 } |
|
14 |
|
15 Flipable { |
|
16 id: flipable |
|
17 width: 200; height: 200 |
|
18 |
|
19 transform: Rotation { |
|
20 id: rotation; angle: 0 |
|
21 origin.x: 100; origin.y: 100 |
|
22 axis.x: 0; axis.y: 1; axis.z: 0 |
|
23 } |
|
24 |
|
25 front: Rectangle { |
|
26 color: "steelblue"; width: 200; height: 200 |
|
27 } |
|
28 |
|
29 back: Rectangle { |
|
30 color: "deeppink"; width: 200; height: 200 |
|
31 } |
|
32 |
|
33 states: State { |
|
34 name: "back" |
|
35 PropertyChanges { target: rotation; angle: 180 } |
|
36 } |
|
37 |
|
38 transitions: Transition { |
|
39 NumberAnimation { easing.type: "InOutQuad"; properties: "angle"; duration: 3000 } |
|
40 } |
|
41 } |
|
42 |
|
43 Flipable { |
|
44 id: flipable2 |
|
45 x: 200; width: 200; height: 200 |
|
46 |
|
47 transform: Rotation { |
|
48 id: rotation2; angle: 0 |
|
49 origin.x: 100; origin.y: 100 |
|
50 axis.x: 1; axis.z: 0 |
|
51 } |
|
52 |
|
53 front: Rectangle { |
|
54 color: "deeppink"; width: 200; height: 200 |
|
55 } |
|
56 |
|
57 back: Rectangle { |
|
58 color: "steelblue"; width: 200; height: 200 |
|
59 } |
|
60 |
|
61 states: State { |
|
62 name: "back" |
|
63 PropertyChanges { target: rotation2; angle: 180 } |
|
64 } |
|
65 |
|
66 transitions: Transition { |
|
67 NumberAnimation { easing.type: "InOutQuad"; properties: "angle"; duration: 3000 } |
|
68 } |
|
69 } |
|
70 |
|
71 Rectangle { |
|
72 x: 25; width: 150; y: 210; height: 20; color: "black" |
|
73 visible: flipable.side == Flipable.Front |
|
74 } |
|
75 Rectangle { |
|
76 x: 225; width: 150; y: 210; height: 20; color: "black" |
|
77 visible: flipable2.side == Flipable.Back |
|
78 } |
|
79 } |