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

Composing animations

The animation we made in the last section looks OK but is not very realistic. The sun should rise in the morning, reach its peak sometime before noon, and then, sometime later, start setting toward the evening, when it should cross the horizon and hide beneath the landscape.

To achieve such an effect, we can add two more animations for the y property of the sun. The first animation would start right at the beginning and decrease the vertical position of the sun (remember that the vertical geometry axis points down, so decreasing the vertical position means the object goes up). The animation would be complete at one-third of the day length. We would then need a way to wait for some time and then start a second animation ...

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