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:
- Create an animation object (such as QPropertyAnimation)
- Set the object that should be animated
- Set the name of the property to be animated
- Define how exactly the value should change (for example, set starting and ending values)
- Start the animation
As you probably know, calling...