|
1 /**************************************************************************** |
|
2 ** |
|
3 ** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). |
|
4 ** All rights reserved. |
|
5 ** Contact: Nokia Corporation (qt-info@nokia.com) |
|
6 ** |
|
7 ** This file is part of the QtDeclarative module of the Qt Toolkit. |
|
8 ** |
|
9 ** $QT_BEGIN_LICENSE:BSD$ |
|
10 ** You may use this file under the terms of the BSD license as follows: |
|
11 ** |
|
12 ** "Redistribution and use in source and binary forms, with or without |
|
13 ** modification, are permitted provided that the following conditions are |
|
14 ** met: |
|
15 ** * Redistributions of source code must retain the above copyright |
|
16 ** notice, this list of conditions and the following disclaimer. |
|
17 ** * Redistributions in binary form must reproduce the above copyright |
|
18 ** notice, this list of conditions and the following disclaimer in |
|
19 ** the documentation and/or other materials provided with the |
|
20 ** distribution. |
|
21 ** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor |
|
22 ** the names of its contributors may be used to endorse or promote |
|
23 ** products derived from this software without specific prior written |
|
24 ** permission. |
|
25 ** |
|
26 ** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS |
|
27 ** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT |
|
28 ** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR |
|
29 ** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT |
|
30 ** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, |
|
31 ** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT |
|
32 ** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
|
33 ** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
|
34 ** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
|
35 ** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
|
36 ** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." |
|
37 ** $QT_END_LICENSE$ |
|
38 ** |
|
39 ****************************************************************************/ |
|
40 |
|
41 import Qt 4.7 |
|
42 |
|
43 Rectangle { |
|
44 id: window |
|
45 width: 600; height: 460; color: "#232323" |
|
46 |
|
47 ListModel { |
|
48 id: easingTypes |
|
49 ListElement { name: "Easing.Linear"; type: Easing.Linear; ballColor: "DarkRed" } |
|
50 ListElement { name: "Easing.InQuad"; type: Easing.InQuad; ballColor: "IndianRed" } |
|
51 ListElement { name: "Easing.OutQuad"; type: Easing.OutQuad; ballColor: "Salmon" } |
|
52 ListElement { name: "Easing.InOutQuad"; type: Easing.InOutQuad; ballColor: "Tomato" } |
|
53 ListElement { name: "Easing.OutInQuad"; type: Easing.OutInQuad; ballColor: "DarkOrange" } |
|
54 ListElement { name: "Easing.InCubic"; type: Easing.InCubic; ballColor: "Gold" } |
|
55 ListElement { name: "Easing.OutCubic"; type: Easing.OutCubic; ballColor: "Yellow" } |
|
56 ListElement { name: "Easing.InOutCubic"; type: Easing.InOutCubic; ballColor: "PeachPuff" } |
|
57 ListElement { name: "Easing.OutInCubic"; type: Easing.OutInCubic; ballColor: "Thistle" } |
|
58 ListElement { name: "Easing.InQuart"; type: Easing.InQuart; ballColor: "Orchid" } |
|
59 ListElement { name: "Easing.OutQuart"; type: Easing.OutQuart; ballColor: "Purple" } |
|
60 ListElement { name: "Easing.InOutQuart"; type: Easing.InOutQuart; ballColor: "SlateBlue" } |
|
61 ListElement { name: "Easing.OutInQuart"; type: Easing.OutInQuart; ballColor: "Chartreuse" } |
|
62 ListElement { name: "Easing.InQuint"; type: Easing.InQuint; ballColor: "LimeGreen" } |
|
63 ListElement { name: "Easing.OutQuint"; type: Easing.OutQuint; ballColor: "SeaGreen" } |
|
64 ListElement { name: "Easing.InOutQuint"; type: Easing.InOutQuint; ballColor: "DarkGreen" } |
|
65 ListElement { name: "Easing.OutInQuint"; type: Easing.OutInQuint; ballColor: "Olive" } |
|
66 ListElement { name: "Easing.InSine"; type: Easing.InSine; ballColor: "DarkSeaGreen" } |
|
67 ListElement { name: "Easing.OutSine"; type: Easing.OutSine; ballColor: "Teal" } |
|
68 ListElement { name: "Easing.InOutSine"; type: Easing.InOutSine; ballColor: "Turquoise" } |
|
69 ListElement { name: "Easing.OutInSine"; type: Easing.OutInSine; ballColor: "SteelBlue" } |
|
70 ListElement { name: "Easing.InExpo"; type: Easing.InExpo; ballColor: "SkyBlue" } |
|
71 ListElement { name: "Easing.OutExpo"; type: Easing.OutExpo; ballColor: "RoyalBlue" } |
|
72 ListElement { name: "Easing.InOutExpo"; type: Easing.InOutExpo; ballColor: "MediumBlue" } |
|
73 ListElement { name: "Easing.OutInExpo"; type: Easing.OutInExpo; ballColor: "MidnightBlue" } |
|
74 ListElement { name: "Easing.InCirc"; type: Easing.InCirc; ballColor: "CornSilk" } |
|
75 ListElement { name: "Easing.OutCirc"; type: Easing.OutCirc; ballColor: "Bisque" } |
|
76 ListElement { name: "Easing.InOutCirc"; type: Easing.InOutCirc; ballColor: "RosyBrown" } |
|
77 ListElement { name: "Easing.OutInCirc"; type: Easing.OutInCirc; ballColor: "SandyBrown" } |
|
78 ListElement { name: "Easing.InElastic"; type: Easing.InElastic; ballColor: "DarkGoldenRod" } |
|
79 ListElement { name: "Easing.InElastic"; type: Easing.OutElastic; ballColor: "Chocolate" } |
|
80 ListElement { name: "Easing.InOutElastic"; type: Easing.InOutElastic; ballColor: "SaddleBrown" } |
|
81 ListElement { name: "Easing.OutInElastic"; type: Easing.OutInElastic; ballColor: "Brown" } |
|
82 ListElement { name: "Easing.InBack"; type: Easing.InBack; ballColor: "Maroon" } |
|
83 ListElement { name: "Easing.OutBack"; type: Easing.OutBack; ballColor: "LavenderBlush" } |
|
84 ListElement { name: "Easing.InOutBack"; type: Easing.InOutBack; ballColor: "MistyRose" } |
|
85 ListElement { name: "Easing.OutInBack"; type: Easing.OutInBack; ballColor: "Gainsboro" } |
|
86 ListElement { name: "Easing.OutBounce"; type: Easing.OutBounce; ballColor: "Silver" } |
|
87 ListElement { name: "Easing.InBounce"; type: Easing.InBounce; ballColor: "DimGray" } |
|
88 ListElement { name: "Easing.InOutBounce"; type: Easing.InOutBounce; ballColor: "SlateGray" } |
|
89 ListElement { name: "Easing.OutInBounce"; type: Easing.OutInBounce; ballColor: "DarkSlateGray" } |
|
90 } |
|
91 |
|
92 Component { |
|
93 id: delegate |
|
94 |
|
95 Item { |
|
96 height: 42; width: window.width |
|
97 |
|
98 Text { text: name; anchors.centerIn: parent; color: "White" } |
|
99 |
|
100 Rectangle { |
|
101 id: slot1; color: "#121212"; x: 30; height: 32; width: 32 |
|
102 border.color: "#343434"; border.width: 1; radius: 8 |
|
103 anchors.verticalCenter: parent.verticalCenter |
|
104 } |
|
105 |
|
106 Rectangle { |
|
107 id: slot2; color: "#121212"; x: window.width - 62; height: 32; width: 32 |
|
108 border.color: "#343434"; border.width: 1; radius: 8 |
|
109 anchors.verticalCenter: parent.verticalCenter |
|
110 } |
|
111 |
|
112 Rectangle { |
|
113 id: rect; x: 30; color: "#454545" |
|
114 border.color: "White"; border.width: 2 |
|
115 height: 32; width: 32; radius: 8 |
|
116 anchors.verticalCenter: parent.verticalCenter |
|
117 |
|
118 MouseArea { |
|
119 onClicked: if (rect.state == '') rect.state = "right"; else rect.state = '' |
|
120 anchors.fill: parent |
|
121 } |
|
122 |
|
123 states : State { |
|
124 name: "right" |
|
125 PropertyChanges { target: rect; x: window.width - 62; color: ballColor } |
|
126 } |
|
127 |
|
128 transitions: Transition { |
|
129 NumberAnimation { properties: "x"; easing.type: type; duration: 1000 } |
|
130 ColorAnimation { properties: "color"; easing.type: type; duration: 1000 } |
|
131 } |
|
132 } |
|
133 } |
|
134 } |
|
135 |
|
136 Flickable { |
|
137 anchors.fill: parent; contentHeight: layout.height |
|
138 |
|
139 Column { |
|
140 id: layout |
|
141 anchors.left: parent.left; anchors.right: parent.right |
|
142 Repeater { model: easingTypes; delegate: delegate } |
|
143 } |
|
144 } |
|
145 } |