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

The Animation framework

For now, we have calculated and applied new positions for our graphics items manually. However, Qt provides a way to do it automatically, called the Animation framework.

The framework is an abstract implementation of animations, so it can be applied to any QObject, such as widgets, or even plain variables. Graphics, items can be animated too, and we will get to this topic soon. Animations are not restricted to the object's coordinates. You can animate color, opacity, or a completely invisible property.

To create an animation, you typically need to perform the following steps:

  1. Create an animation object (such as QPropertyAnimation)
  2. Set the object that should be animated
  3. Set the name of the property to be animated

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