[Interest] Loader seems to be blocking animation

Sletta Gunnar Gunnar.Sletta at digia.com
Wed Dec 11 09:38:40 CET 2013


Though you set the animation to running, it needs to sync up with the renderthread for it to actually start. As you trigger the loader right away, the animation doesn't actually get to start. If you change it into something like this it will work:

        ParallelAnimation {
            id: animation

            SequentialAnimation {
                PauseAnimation { duration: 20; }
                ScriptAction { script: loadMyPage(); }
            }

            YAnimator {
                id: highlighterRectAnimator
                target: highlighterRect
                duration: 250
            }
        }

cheers,
Gunnar


________________________________________
Fra: interest-bounces+gunnar.sletta=digia.com at qt-project.org [interest-bounces+gunnar.sletta=digia.com at qt-project.org] på vegne av VStevenP [vstevenpavao at yahoo.com]
Sendt: 10. desember 2013 21:24
To: Sletta Gunnar; interest at qt-project.org
Emne: Re: [Interest] Loader seems to be blocking animation

I switched over to using the new YAnimator type for my icon highlighter rectangle.  The animation works, but it's still blocked by the QML Loader, on both Android and Mac Desktop.

I got rid of all the old-style states and transitions syntax, and simply switched over to the following syntax:


...

    property int currentTab: 0

    Rectangle {
        id: pageTabs
        anchors.fill: parent
        color: "darkgrey"

        Rectangle {
            id: highlighterRect
            width: pageTabsPane.width

            height: pageTabsPane.width  // a square
            color: "black"

            YAnimator {
                id: highlighterRectAnimator
                target: highlighterRect
                duration: 40
            }

            Component.onCompleted {
                y = homeIcon.y
            }
        }

        PageTabIcon {
            id: homeIcon
            source:"img/homeIcon.svg"

            onPageTabIconClicked: {
                highlighterRectAnimator.from = highlighterRect.y
                highlighterRectAnimator.to = homeIcon.y
                highlighterRectAnimator.running = true
                currentTab = Common.PageView.Home
            }
        }

        PageTabIcon {
            id: mixIcon
            y: pageTabsPane.width
            source: "img/mixIcon.svg"

            onPageTabIconClicked: {
                highlighterRectAnimator.from = highlighterRect.y
                highlighterRectAnimator.to = mixIcon.y
                highlighterRectAnimator.running = true
                currentTab=Common.PageView.Mix
            }
        }
...
}

Is this the wrong syntax?  It's the one syntax I figured out that seemed to cause the Yanimation to work for animating the highlighted background from icon to icon.

- VStevenP


----- Original Message -----
From: Sletta Gunnar <Gunnar.Sletta at digia.com>
To: VStevenP <vstevenpavao at yahoo.com>; "interest at qt-project.org" <interest at qt-project.org>
Cc:
Sent: Tuesday, December 10, 2013 8:43 AM
Subject: SV: [Interest] Loader seems to be blocking animation

You want to have a look at the new Animator types introduced in Qt 5.2. These run on the render thread and won't be blocked when the loader is running.

http://doc-snapshot.qt-project.org/qt5-stable/qtquick-statesanimations-topic.html#animators

cheers,
Gunnar
_______________________________________________
Interest mailing list
Interest at qt-project.org
http://lists.qt-project.org/mailman/listinfo/interest



More information about the Interest mailing list