O'Reilly logo

Game Programming using Qt 5 Beginner's Guide - Second Edition by Lorenz Haas, Witold Wysota, Pavel Strakhov

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Time for action – Making the sun rise and set

Let's add vertical movement (animation of the y property) to our sun by adding a sequence of animations to the QML document. As our new animations will be running in parallel to the horizontal animation, we can enclose animations for both directions within a single ParallelAnimation group. It would work, but in our opinion, this will unnecessarily clutter the document. Another way of specifying parallel animations is to declare them as separate hierarchies of elements, making each animation independent of the other, and that is what we will do here.

Open our document from the last exercise, and right under the previous animation, place the following code:

SequentialAnimation {    running: true NumberAnimation ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required