A curve with the desired shape and size is created and a ball is set to move along the shape of the curve on the click of a push button. In this recipe, you will understand how to implement a guided animation.
Making a ball animate as per the specified curve
How to do it...
The setKeyValueAt method of the QPropertyAnimation class determines the direction of an animation. For guided animation, you invoke the setKeyValueAt method in a loop. The coordinates of the curve are passed to the setKeyValueAt method in the loop to make the ball animate along the curve. Here are the steps to make an object animate as desired:
- Create a new application based on the Dialog without Buttons template.
- Drag and drop a Label...