How it works...
First of all, you make the curve appear on the screen. This is the curve that will guide the ball's animation; that is, it will act as a path for the animation. You define an instance of the QPainterPath class and name it path. You invoke the moveTo method of the QPainterPath class to specify the starting location of the path or curve. The cubicTo method is invoked to specify the curved path for the ball's animation.
You can see that the click event of the Push Button widget with the objectName property pushButtonMoveCurve is connected to the startAnimation method; when the Push Button widget is clicked, the startAnimation() method will be invoked. In the startAnimation method, you create an object of the QPropertyAnimation ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access