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

Using a ParallelAnimation with 2 seperate Sequential uses of Pause and Animator is broken

    XMLWordPrintable

Details

    • Bug
    • Resolution: Done
    • P2: Important
    • 5.4.0
    • 5.2.1, 5.3.0 Alpha
    • None
    • OS X 10.9.2
    • 9bd69842ed8a03381914733a778fbda0d3d56630 2d8cde43e8ead44fb8bae7078741ca2fe6266733 be49c10b77ff997a7f1395d9e4e80eab02a2b387 84cebba0c9beba4190372113856708558e406b38 e407ca970ad956cfdc0c8394942881fc82d5ebe9

    Description

      The example below shows what should be 2 almost identical animations. A parallel animation makes a yellow bar go down the screen with a red one that follows after a pause. The animation should loop forever. The first loop is fine. But with the one that uses the Animator the second loop goes nuts and then after 3 loops stops running all together. I looked at the Animtors tests and none of them use PauseAnimations.

      The real use case is a constant animation that is always running in this app. I wanted to use the Animtor as it means even when the app is busy this constant animation gives the impression it is fully responsive. Pauses are needed without them the types of animation you can use the Animator on are too limited. For the current app this kind of bug makes the Animator useless, which is a real shame as render thread animations have such amazing potential.

      OH after writing this I found a work around. I broke the ParallelAnimation into 2 separate SequentialAnimations and then it works fine. So the problem is not so much the pause as the 2 sequentials inside a parallel. Still a bug.

      import QtQuick 2.2
      
      Rectangle {
          id: root
          width: 500
          height: 500
          color: "black"
      
          ParallelAnimation {
              running: true
              loops: Animation.Infinite
              SequentialAnimation {
                  YAnimator {
                      target: bar1
                      from: 0; to: root.height;
                      duration: 4000;
                  }
                  PauseAnimation { duration: 500 }
              }
              SequentialAnimation {
                  PauseAnimation { duration: 500 }
                  YAnimator {
                      target: bar2
                      from: 0; to: root.height;
                      duration: 4000;
                  }
              }
          }
      
          ParallelAnimation {
              running: true
              loops: Animation.Infinite
              SequentialAnimation {
                  NumberAnimation {
                      target: bar3
                      property: "y"
                      from: 0; to: root.height;
                      duration: 4000;
                  }
                  PauseAnimation { duration: 500 }
              }
              SequentialAnimation {
                  PauseAnimation { duration: 500 }
                  NumberAnimation {
                      target: bar4
                      property: "y"
                      from: 0; to: root.height;
                      duration: 4000;
                  }
              }
          }
          Item {
              id: bar1
              Rectangle {
                  height: root.height * 0.03
                  width: root.width / 4
                  color: "yellow"
              }
          }
      
          Item {
              id: bar2
              Rectangle {
                  height: root.height * 0.03
                  width: root.width / 2
                  color: "red"
              }
          }
          Item {
              id: bar3
              Rectangle {
                  x: root.width / 2
                  height: root.height * 0.03
                  width: root.width / 4
                  color: "yellow"
              }
          }
      
          Item {
              id: bar4
              Rectangle {
                  x: root.width / 2
                  height: root.height * 0.03
                  width: root.width / 2
                  color: "red"
              }
          }
      
      }
      

      Attachments

        For Gerrit Dashboard: QTBUG-37246
        # Subject Branch Project Status CR V

        Activity

          People

            sletta Gunnar Sletta
            designker Nigel Hietala
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes