i m showing 3 images horizontally at a time using PathLine.
The left and right image need to be shown as 50% faded from left & 50% faded from right.
Here i cannot use a black rectangle gradient to show the fade effect as my parent is 20% transparent & it floats on a background video.
So is there any ways to apply the opacity property as a horizontal fade animation?
With the QML
ShaderEffectItemelement you can add post-effects to a QML item using a shader program. This enables you to do some graphics effects on the GPU.As you see in the documentation I’ve linked above, this can for example be a wave effect. In general, you apply a small “program” to every output pixel. This is the so-called fragment shader in GLSL.
To give you an idea of how you could implement a alpha mask on an item (this might be your scene which contains the images on the path which you are animating), I’ll give an example in which I implement a simple linear gradient as the alpha mask, where on the left we have zero opacity and on the right full opacity.
The most important line in the shader program is the value of the
alphavariable. In this small example I just set the X component of the texture coordinate as the alpha value, thus at the left border it is 0, at the right border it is 1. Note that the texture coordinates are not measured in pixels but in a [0..1] range. If you want to access pixel coordinates, you can usegl_FragCoord.x/y. Note thatyis measured from bottom to top, so 0 is the bottom border andheightis the top border. Per default you can’t access theheightof the whole resulting image, but therefore we can use uniforms. Just assign a newproperty int h: heightand access it usinguniform float hin the shader.