Last active
December 10, 2015 13:28
-
-
Save usagi/4441640 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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: { var t = time_; console.log(t); t } | |
property real time_ | |
NumberAnimation on time_ { | |
from: 0 | |
to: 1 //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