Something old and forgotten
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 

302 lines
8.4 KiB

import QtQuick 1.0
import Qt.labs.shaders 1.0
Rectangle {
width: 300
height: 300
color: "black"
Rectangle {
id: texture
anchors.fill: parent
anchors.margins: 40
gradient: Gradient {
GradientStop {
position: 0.0
color: "lightblue"
}
GradientStop {
position: 1.0
color: "lightgreen"
}
}
opacity: 0.75
Grid {
columns: 3
rows: 2
spacing: 5
Repeater {
model: 6
Item {
width: 75
height: 75
Rectangle {
color: "black"
opacity: 0.5
anchors.fill: parent
}
Text { text: index; anchors.centerIn: parent; color: "white" }
}
}
}
MouseArea {
anchors.fill: parent
onClicked: console.debug("Clicked!!!")
}
}
ShaderEffectItem {
property variant source: ShaderEffectSource { sourceItem: texture; hideSource: true }
property real wiggleAmount: 0.005
property real angle: 0
property real yPos: 0
anchors.fill: texture
SequentialAnimation on wiggleAmount {
loops: Animation.Infinite
NumberAnimation {
from: -0.005
to: 0.005
duration: 1000
}
NumberAnimation {
from: 0.005
to: -0.005
duration: 1000
}
}
// SequentialAnimation on angle {
// loops: Animation.Infinite
// NumberAnimation {
// from: -3.1416
// to: 3.1416
// duration: 2000
// }
// NumberAnimation {
// from: 3.1416
// to: -3.1416
// duration: 2000
// }
// }
SequentialAnimation on angle {
loops: Animation.Infinite
NumberAnimation {
from: -3.1416 * 3.0
to: 0
duration: 2000
}
PauseAnimation { duration: 5000 }
NumberAnimation {
from: 0
to: 3.1416 * 3.0
duration: 2000
}
PauseAnimation { duration: 5000 }
}
SequentialAnimation on yPos {
loops: Animation.Infinite
NumberAnimation {
from: 2.0
to: 0.0
duration: 2000
}
PauseAnimation { duration: 5000 }
NumberAnimation {
from: 0.0
to: -2.0
duration: 2000
}
PauseAnimation { duration: 5000 }
}
fragmentShader: "
varying highp vec2 qt_TexCoord0;
uniform sampler2D source;
uniform highp float wiggleAmount;
void main(void)
{
highp vec2 wiggledTexCoord = qt_TexCoord0;
wiggledTexCoord.s += sin(4.0 * 3.141592653589 * wiggledTexCoord.t) * wiggleAmount;
gl_FragColor = texture2D(source, wiggledTexCoord.st);
}"
vertexShader: "
uniform highp mat4 qt_ModelViewProjectionMatrix;
attribute highp vec4 qt_Vertex;
attribute highp vec2 qt_MultiTexCoord0;
varying highp vec2 qt_TexCoord0;
uniform highp float angle;
uniform highp float yPos;
void main(void)
{
highp mat4 mat = mat4( 1.0, 0.0, 0.0, 0.0,
0.0, 1.0, 0.0, 0.0,
0.0, 0.0, 1.0, 10.0,
0.0, 0.0, 0.0, 1.0);
highp mat4 rotationMatrix = mat4(1.0, 0.0, 0.0, 0.0,
0.0, cos(angle), -sin(angle), yPos,
0.0, sin(angle), cos(angle), 0.0,
0.0, 0.0, 0.0, 1.0);
qt_TexCoord0 = qt_MultiTexCoord0;
highp mat4 prjMat = qt_ModelViewProjectionMatrix * mat;
gl_Position = prjMat * qt_Vertex * rotationMatrix;
}"
}
Rectangle {
id: texture2
anchors.fill: parent
anchors.margins: 40
gradient: Gradient {
GradientStop {
position: 0.0
color: "lightblue"
}
GradientStop {
position: 1.0
color: "lightgreen"
}
}
opacity: 0.75
Text {
id: textLabel2
text: "Drasteee Svet"
anchors.centerIn: parent
font.pixelSize: 32
color: "white"
}
MouseArea {
anchors.fill: parent
onClicked: console.debug("Clicked2!!!")
}
}
ShaderEffectItem {
property variant source: ShaderEffectSource { sourceItem: texture2; hideSource: true }
property real wiggleAmount: 0.005
property real angle: 0
property real yPos: 0
anchors.fill: texture2
SequentialAnimation on wiggleAmount {
loops: Animation.Infinite
NumberAnimation {
from: -0.005
to: 0.005
duration: 1000
}
NumberAnimation {
from: 0.005
to: -0.005
duration: 1000
}
}
// SequentialAnimation on angle {
// loops: Animation.Infinite
// NumberAnimation {
// from: -3.1416
// to: 3.1416
// duration: 2000
// }
// NumberAnimation {
// from: 3.1416
// to: -3.1416
// duration: 2000
// }
// }
SequentialAnimation on angle {
loops: Animation.Infinite
NumberAnimation {
from: 0
to: 3.1416 * 3.0
duration: 2000
}
PauseAnimation { duration: 5000 }
NumberAnimation {
from: -3.1416 * 3.0
to: 0
duration: 2000
}
PauseAnimation { duration: 5000 }
}
SequentialAnimation on yPos {
loops: Animation.Infinite
NumberAnimation {
from: 0.0
to: -2.0
duration: 2000
}
PauseAnimation { duration: 5000 }
NumberAnimation {
from: 2.0
to: 0.0
duration: 2000
}
PauseAnimation { duration: 5000 }
}
fragmentShader: "
varying highp vec2 qt_TexCoord0;
uniform sampler2D source;
uniform highp float wiggleAmount;
void main(void)
{
highp vec2 wiggledTexCoord = qt_TexCoord0;
wiggledTexCoord.s += sin(4.0 * 3.141592653589 * wiggledTexCoord.t) * wiggleAmount;
gl_FragColor = texture2D(source, wiggledTexCoord.st);
}"
vertexShader: "
uniform highp mat4 qt_ModelViewProjectionMatrix;
attribute highp vec4 qt_Vertex;
attribute highp vec2 qt_MultiTexCoord0;
varying highp vec2 qt_TexCoord0;
uniform highp float angle;
uniform highp float yPos;
void main(void)
{
highp mat4 mat = mat4( 1.0, 0.0, 0.0, 0.0,
0.0, 1.0, 0.0, 0.0,
0.0, 0.0, 1.0, 10.0,
0.0, 0.0, 0.0, 1.0);
highp mat4 rotationMatrix = mat4(1.0, 0.0, 0.0, 0.0,
0.0, cos(angle), -sin(angle), yPos,
0.0, sin(angle), cos(angle), 0.0,
0.0, 0.0, 0.0, 1.0);
qt_TexCoord0 = qt_MultiTexCoord0;
highp mat4 prjMat = qt_ModelViewProjectionMatrix * mat;
gl_Position = prjMat * qt_Vertex * rotationMatrix;
}"
}
}