Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-64580

NumberAnimation properties not re-evaluated in consecutive runs of the animation

    XMLWordPrintable

Details

    • Bug
    • Resolution: Unresolved
    • P3: Somewhat important
    • None
    • 5.10
    • Documentation
    • None

    Description

      Given the following code (untested, for illustration):

      Item {
          id: root
          property int x: 0
          NumberAnimation {
              id: anim
              target: root
              property: "x"
              from: x
              to: x + 10
              duration: 1000
              loops: Animation.Infinite
          }
      }  
      

      Now, anim.from is initialized to 0 and anim.to to 10 in every iteration of the loop. This means that x will go from 0 to 10, and then restart from 0 to 10, ad infinitum. This behaviour won't change in qml, but it should be documented (in http://doc.qt.io/qt-5/qml-qtquick-numberanimation.html).

      The workaround is to replace

              loops: Animation.Infinite
      

      with

              onStopped: start()
      

      Attachments

        Issue Links

          No reviews matched the request. Check your Options in the drop-down menu of this sections header.

          Activity

            People

              docteam Qt Documentation Team
              fdv Fredrik de Vibe
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

                Created:
                Updated:

                Gerrit Reviews

                  There are no open Gerrit changes