Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. QML and Qt Quick
  4. UniformAnimator does not work under item `layer.effect`
Forum Updated to NodeBB v4.3 + New Features

UniformAnimator does not work under item `layer.effect`

Scheduled Pinned Locked Moved Solved QML and Qt Quick
2 Posts 1 Posters 326 Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • tracymaT Offline
    tracymaT Offline
    tracyma
    wrote on last edited by
    #1

    i am applying custom ShaderEffect to item layer, and there is a time animator in my effect. The time seems keeping the same value. The full project is here

    Rectangle {
            id: rect
            width: root.width
            height: root.height
            color: "pink"
    
            visible: true
            layer.enabled: true
            layer.effect: ShaderEffect {
                id: effect
                width: background.width
                height: background.height
                property real time: 0
                UniformAnimator on time {
                    from: 0.0
                    to: 1.0
                    duration: 0
                    running: true
                    loops: Animation.Infinite
                }
    
                vertexShader: "#version 410
                                uniform highp mat4 qt_Matrix;
                                in highp vec4 qt_Vertex;
                                in highp vec2 qt_MultiTexCoord0;
                                out highp vec2 coord;
                                void main() {
                                    coord = qt_MultiTexCoord0;
                                    gl_Position = qt_Matrix * qt_Vertex;
                                }
                                "
                fragmentShader: "#version 410
                                in highp vec2 coord;
                                uniform highp float time;
                                uniform sampler2D source;
                                uniform lowp float qt_Opacity;
                                out lowp vec4 outColor;
                                void main() {
                                    lowp vec4 tex = texture(source, coord);
                                    lowp float alpha;
                                    if ( coord.x > time )
                                    {
                                        outColor = vec4(1.0, 1.0, 1.0, 1.0);
                                    }
                                    else
                                    {
                                        outColor = tex * qt_Opacity;
                                    }
    
                                }"
            }
        }
    
    1 Reply Last reply
    0
    • tracymaT Offline
      tracymaT Offline
      tracyma
      wrote on last edited by
      #2

      the dutation should not be zero. fixed!

      1 Reply Last reply
      0

      • Login

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • Users
      • Groups
      • Search
      • Get Qt Extensions
      • Unsolved