Skip to content

Instantly share code, notes, and snippets.

@usagi
Last active December 10, 2015 13:28
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save usagi/4441640 to your computer and use it in GitHub Desktop.
Save usagi/4441640 to your computer and use it in GitHub Desktop.
import QtQuick 2.0
Row {
Image {
id: image
width: 200
height: 200
source: "usagi-logo.png"
}
ShaderEffect {
width: 300
height: 300
property var source: image
property real frequency: 20
property real amplitude: 0.05
property real time
NumberAnimation on time {
from: 0
to: Math.PI * 2
duration: 1000
loops: Animation.Infinite
}
fragmentShader:
"
varying highp vec2 qt_TexCoord0;
uniform sampler2D source;
uniform lowp float qt_Opacity;
uniform highp float frequency;
uniform highp float amplitude;
uniform highp float time;
void main() {
highp vec2 p = sin(time + frequency * qt_TexCoord0);
gl_FragColor = texture2D(source, qt_TexCoord0
+ amplitude * vec2(p.x, -p.y)) * qt_Opacity;
}
"
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment