Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. QML and Qt Quick
  4. Animation on changing image source
Qt 6.12 LTS is out! See what's new in the release blog

Animation on changing image source

Scheduled Pinned Locked Moved QML and Qt Quick
4 Posts 3 Posters 7.0k Views 1 Watching
  • 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.
  • L Offline
    L Offline
    luca
    wrote on last edited by
    #1

    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...

    1 Reply Last reply
    0
    • ? Offline
      ? Offline
      A Former User
      wrote on last edited by
      #2

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

      1 Reply Last reply
      0
      • T Offline
        T Offline
        task_struct
        wrote on last edited by
        #3

        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 )

        "Most good programmers do programming not because they expect to get paid or get adulation by the public, but because it is fun to program."

        • Linu...
        1 Reply Last reply
        0
        • ? Offline
          ? Offline
          A Former User
          wrote on last edited by
          #4

          true

          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
          • Unsolved