Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
[slider] Shader effect added for slider
  • Loading branch information
locusf committed Oct 5, 2013
1 parent d5c3ea1 commit 77fc510
Showing 1 changed file with 34 additions and 8 deletions.
42 changes: 34 additions & 8 deletions src/styles/SliderStyle.qml
Expand Up @@ -25,15 +25,15 @@ SliderStyle {
GrooveStyle {
id: grooveStyle
}

handle:
Image {
source: control.pressed ? "images/slider-trumpet-stretch.png" : "images/slider-trumpet.png"
z: 0
visible: control.enabled
ShaderEffectSource {
id: shadersource
width: 100
height: 45
sourceItem: Image {
source: control.pressed ? "images/slider-trumpet-stretch.png" : "images/slider-trumpet.png"
z: 0
visible: control.enabled
Image {
anchors.horizontalCenter: parent.right
anchors.verticalCenter: parent.verticalCenter
id: ball
source: "images/slider-ball.png"
z: 1
Expand All @@ -48,5 +48,31 @@ SliderStyle {
}
}
}
}

handle: ShaderEffect {
id: trumpet_shader
width: 100
height: 45
mesh: GridMesh {
resolution: Qt.size(100,45)
}

property variant source: shadersource
vertexShader: "
uniform highp mat4 qt_Matrix;
attribute highp vec4 qt_Vertex;
attribute highp vec2 qt_MultiTexCoord0;
varying highp vec2 qt_TexCoord0;
uniform highp float width;
void main() {
highp vec4 pos = qt_Vertex;
highp float d = 1.0;
pos.x = width * mix(d, 1.0 - d, qt_MultiTexCoord0.x);
gl_Position = qt_Matrix * qt_Vertex;
qt_TexCoord0 = qt_MultiTexCoord0;
}
"
}
groove: grooveStyle;
}

0 comments on commit 77fc510

Please sign in to comment.