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 ...

Get Game Programming using Qt 5 Beginner's Guide - Second Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.