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. How to animate a Image with color?
QtWS25 Last Chance

How to animate a Image with color?

Scheduled Pinned Locked Moved Unsolved QML and Qt Quick
6 Posts 2 Posters 529 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.
  • C Offline
    C Offline
    Cheng shi hua
    wrote on last edited by Cheng shi hua
    #1

    title,

    ColorAnimation { target: colorLay; to: "#80000000"; duration: 100 }

    ColorOverlay {
    id: colorLay
    anchors.fill: myImage
    source: myImage
    color: "#80800000"
    }

    there is not work

    ODБOïO 1 Reply Last reply
    0
    • C Cheng shi hua

      title,

      ColorAnimation { target: colorLay; to: "#80000000"; duration: 100 }

      ColorOverlay {
      id: colorLay
      anchors.fill: myImage
      source: myImage
      color: "#80800000"
      }

      there is not work

      ODБOïO Offline
      ODБOïO Offline
      ODБOï
      wrote on last edited by ODБOï
      #2

      @Cheng-shi-hua hi
      you want to animate the color property of the ColorOverlay , you can do it like this

      ApplicationWindow {
          width: 800
          height: 600
          visible: true
      
          Item {
              width: 300
              height: 300
      
              Image {
                  id: img
                  source: "image.jpg"
                  sourceSize: Qt.size(parent.width, parent.height)
                  smooth: true
                  visible: false
              }
              ColorOverlay {
                  ColorAnimation on color {
                      from:Qt.rgba(1,0,0,0.2)
                      to: Qt.rgba(0,0,1,0.2)
                      //loops: Animation.Infinite
                      duration: 500
                  }
                  id: colorLay
                  anchors.fill: img
                  source: img
                  color: col
      
              }
          }
      }
      
      C 1 Reply Last reply
      1
      • ODБOïO ODБOï

        @Cheng-shi-hua hi
        you want to animate the color property of the ColorOverlay , you can do it like this

        ApplicationWindow {
            width: 800
            height: 600
            visible: true
        
            Item {
                width: 300
                height: 300
        
                Image {
                    id: img
                    source: "image.jpg"
                    sourceSize: Qt.size(parent.width, parent.height)
                    smooth: true
                    visible: false
                }
                ColorOverlay {
                    ColorAnimation on color {
                        from:Qt.rgba(1,0,0,0.2)
                        to: Qt.rgba(0,0,1,0.2)
                        //loops: Animation.Infinite
                        duration: 500
                    }
                    id: colorLay
                    anchors.fill: img
                    source: img
                    color: col
        
                }
            }
        }
        
        C Offline
        C Offline
        Cheng shi hua
        wrote on last edited by
        #3

        @LeLev
        thanks!

        If this is not ColorOverlay , how to animate a Image?

        ODБOïO 1 Reply Last reply
        0
        • C Cheng shi hua

          @LeLev
          thanks!

          If this is not ColorOverlay , how to animate a Image?

          ODБOïO Offline
          ODБOïO Offline
          ODБOï
          wrote on last edited by ODБOï
          #4

          @Cheng-shi-hua said in How to animate a Image with color?:

          how to animate a Image?

          you will not animate the Image it self, what property of the image you want to animate ?

          C 1 Reply Last reply
          0
          • ODБOïO ODБOï

            @Cheng-shi-hua said in How to animate a Image with color?:

            how to animate a Image?

            you will not animate the Image it self, what property of the image you want to animate ?

            C Offline
            C Offline
            Cheng shi hua
            wrote on last edited by
            #5

            @LeLev
            what property of the image you want to animate ?
            property color
            buy Image have no property color
            so, how to animate color with Image

            ODБOïO 1 Reply Last reply
            0
            • C Cheng shi hua

              @LeLev
              what property of the image you want to animate ?
              property color
              buy Image have no property color
              so, how to animate color with Image

              ODБOïO Offline
              ODБOïO Offline
              ODБOï
              wrote on last edited by ODБOï
              #6

              i don't understand sorry. Image has no color property
              if you have 2 images each with different color then change the source property to show one or the other

              1 Reply Last reply
              1

              • Login

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