Important: Please read the Qt Code of Conduct -

Animation on changing image source

  • Hi all,
    I have this QML:
    property int count_img_attuale:0
    Image {
    id: immagine

            anchors.fill: parent
            source: "file:" + fileNameList[count_img_attuale]


    when I change the value of count_img_attuale I get a new Image showing.

    Is there a way to animate the new Image showing?
    I'm thinking on a fade in and fade out or similar...

  • I would use onCount_img_attuale to set a new state with all transformations you want, including the source of immagine ;) !

  • Hi,

    Once you change something in @"file:" + fileNameList[count_img_attuale]@, new image will be loaded and you won't be able to make fade out animation. So you need "double buffering" - two Image elements on same place.

    When count_img_attuale is changed set back one to new source and start parallel animations for opacities of two images ( old one from 1 to 0 and new one from 0 to 1 )

  • true

Log in to reply