1 /****************************************************************************
3 ** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
4 ** All rights reserved.
5 ** Contact: Nokia Corporation (qt-info@nokia.com)
7 ** This file is part of the Declarative module of the Qt Toolkit.
9 ** $QT_BEGIN_LICENSE:LGPL$
10 ** GNU Lesser General Public License Usage
11 ** This file may be used under the terms of the GNU Lesser General Public
12 ** License version 2.1 as published by the Free Software Foundation and
13 ** appearing in the file LICENSE.LGPL included in the packaging of this
14 ** file. Please review the following information to ensure the GNU Lesser
15 ** General Public License version 2.1 requirements will be met:
16 ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
18 ** In addition, as a special exception, Nokia gives you certain additional
19 ** rights. These rights are described in the Nokia Qt LGPL Exception
20 ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
22 ** GNU General Public License Usage
23 ** Alternatively, this file may be used under the terms of the GNU General
24 ** Public License version 3.0 as published by the Free Software Foundation
25 ** and appearing in the file LICENSE.GPL included in the packaging of this
26 ** file. Please review the following information to ensure the GNU General
27 ** Public License version 3.0 requirements will be met:
28 ** http://www.gnu.org/copyleft/gpl.html.
31 ** Alternatively, this file may be used in accordance with the terms and
32 ** conditions contained in a signed written agreement between you and Nokia.
40 ****************************************************************************/
47 source: "../snake/content/pics/background.png"
55 function saturate(x) {
56 return Math.min(Math.max(x, 0), 1)
59 function sliderToColor(x) {
60 return Qt.rgba(saturate(Math.max(2 - 6 * x, 6 * x - 4)),
61 saturate(Math.min(6 * x, 4 - 6 * x)),
62 saturate(Math.min(6 * x - 2, 6 - 6 * x)))
66 anchors.centerIn: parent
74 anchors.centerIn: parent
78 snapMode: ListView.SnapOneItem
79 model: VisualItemModel {
83 horizontalAlignment: Text.AlignHCenter
84 verticalAlignment: Text.AlignVCenter
99 source: "face-smile.png"
108 property variant source: theSource
109 property real amplitude: 0.04 * wobbleSlider.value
110 property real frequency: 20
111 property real time: 0
112 NumberAnimation on time { loops: Animation.Infinite; from: 0; to: Math.PI * 2; duration: 600 }
114 "uniform highp float amplitude;" +
115 "uniform highp float frequency;" +
116 "uniform highp float time;" +
117 "uniform sampler2D source;" +
118 "varying highp vec2 qt_TexCoord0;" +
120 " highp vec2 p = sin(time + frequency * qt_TexCoord0);" +
121 " gl_FragColor = texture2D(source, qt_TexCoord0 + amplitude * vec2(p.y, -p.x));" +
125 anchors.left: parent.left
126 anchors.right: parent.right
127 anchors.bottom: parent.bottom
134 property variant source: theSource
135 property variant shadow: ShaderEffectSource {
137 sourceItem: ShaderEffect {
139 height: theItem.height
140 property variant delta: Qt.size(0.0, 1.0 / height)
141 property variant source: ShaderEffectSource {
143 sourceItem: ShaderEffect {
145 height: theItem.height
146 property variant delta: Qt.size(1.0 / width, 0.0)
147 property variant source: theSource
149 uniform sampler2D source;
150 uniform highp vec2 delta;
151 varying highp vec2 qt_TexCoord0;
153 gl_FragColor = 0.0538 * texture2D(source, qt_TexCoord0 - 3.182 * delta)
154 + 0.3229 * texture2D(source, qt_TexCoord0 - 1.364 * delta)
155 + 0.2466 * texture2D(source, qt_TexCoord0)
156 + 0.3229 * texture2D(source, qt_TexCoord0 + 1.364 * delta)
157 + 0.0538 * texture2D(source, qt_TexCoord0 + 3.182 * delta);
162 uniform sampler2D source;
163 uniform highp vec2 delta;
164 varying highp vec2 qt_TexCoord0;
166 gl_FragColor = 0.0538 * texture2D(source, qt_TexCoord0 - 3.182 * delta)
167 + 0.3229 * texture2D(source, qt_TexCoord0 - 1.364 * delta)
168 + 0.2466 * texture2D(source, qt_TexCoord0)
169 + 0.3229 * texture2D(source, qt_TexCoord0 + 1.364 * delta)
170 + 0.0538 * texture2D(source, qt_TexCoord0 + 3.182 * delta);
174 property real angle: 0
175 property variant offset: Qt.point(15.0 * Math.cos(angle), 15.0 * Math.sin(angle))
176 NumberAnimation on angle { loops: Animation.Infinite; from: 0; to: Math.PI * 2; duration: 6000 }
177 property variant delta: Qt.size(offset.x / width, offset.y / height)
178 property real darkness: shadowSlider.value
180 uniform highp vec2 offset;
181 uniform sampler2D source;
182 uniform sampler2D shadow;
183 uniform highp float darkness;
184 uniform highp vec2 delta;
185 varying highp vec2 qt_TexCoord0;
187 lowp vec4 fg = texture2D(source, qt_TexCoord0);
188 lowp vec4 bg = texture2D(shadow, qt_TexCoord0 + delta);
189 gl_FragColor = fg + vec4(0., 0., 0., darkness * bg.a) * (1. - fg.a);
193 anchors.left: parent.left
194 anchors.right: parent.right
195 anchors.bottom: parent.bottom
202 property variant source: theSource
203 property variant delta: Qt.size(0.5 / width, 0.5 / height)
205 uniform sampler2D source;
206 uniform highp vec2 delta;
207 uniform highp float qt_Opacity;
208 varying highp vec2 qt_TexCoord0;
210 lowp vec4 tl = texture2D(source, qt_TexCoord0 - delta);
211 lowp vec4 tr = texture2D(source, qt_TexCoord0 + vec2(delta.x, -delta.y));
212 lowp vec4 bl = texture2D(source, qt_TexCoord0 - vec2(delta.x, -delta.y));
213 lowp vec4 br = texture2D(source, qt_TexCoord0 + delta);
214 lowp vec4 gx = (tl + bl) - (tr + br);
215 lowp vec4 gy = (tl + tr) - (bl + br);
216 gl_FragColor.xyz = vec3(0.);
217 gl_FragColor.w = clamp(dot(sqrt(gx * gx + gy * gy), vec4(1.)), 0., 1.) * qt_Opacity;
223 property variant source: theSource
224 property color tint: sliderToColor(colorizeSlider.value)
226 uniform sampler2D source;
227 uniform lowp vec4 tint;
228 uniform lowp float qt_Opacity;
229 varying highp vec2 qt_TexCoord0;
231 lowp vec4 c = texture2D(source, qt_TexCoord0);
232 lowp float lo = min(min(c.x, c.y), c.z);
233 lowp float hi = max(max(c.x, c.y), c.z);
234 gl_FragColor = qt_Opacity * vec4(mix(vec3(lo), vec3(hi), tint.xyz), c.w);
238 anchors.left: parent.left
239 anchors.right: parent.right
240 anchors.bottom: parent.bottom
247 mesh: Qt.size(10, 10)
248 property variant source: theSource
249 property real bend: 0
250 property real minimize: 0
251 property real side: genieSlider.value
252 SequentialAnimation on bend {
253 loops: Animation.Infinite
254 NumberAnimation { to: 1; duration: 700; easing.type: Easing.InOutSine }
255 PauseAnimation { duration: 1600 }
256 NumberAnimation { to: 0; duration: 700; easing.type: Easing.InOutSine }
257 PauseAnimation { duration: 1000 }
259 SequentialAnimation on minimize {
260 loops: Animation.Infinite
261 PauseAnimation { duration: 300 }
262 NumberAnimation { to: 1; duration: 700; easing.type: Easing.InOutSine }
263 PauseAnimation { duration: 1000 }
264 NumberAnimation { to: 0; duration: 700; easing.type: Easing.InOutSine }
265 PauseAnimation { duration: 1300 }
268 uniform highp mat4 qt_Matrix;
269 uniform highp float bend;
270 uniform highp float minimize;
271 uniform highp float side;
272 uniform highp float width;
273 uniform highp float height;
274 attribute highp vec4 qt_Vertex;
275 attribute highp vec2 qt_MultiTexCoord0;
276 varying highp vec2 qt_TexCoord0;
278 qt_TexCoord0 = qt_MultiTexCoord0;
279 highp vec4 pos = qt_Vertex;
280 pos.y = mix(qt_Vertex.y, height, minimize);
281 highp float t = pos.y / height;
282 t = (3. - 2. * t) * t * t;
283 pos.x = mix(qt_Vertex.x, side * width, t * bend);
284 gl_Position = qt_Matrix * pos;
288 anchors.left: parent.left
289 anchors.right: parent.right
290 anchors.bottom: parent.bottom