Property value sources

From the QML perspective, Animation and element types derived from it are called property value sources. This means they can be attached to a property and generate values for it. What is important is that it allows us to use animations using a much simpler syntax. Instead of explicitly declaring the target and property of an animation, you can attach the animation to a named property of the parent object.

To do this, instead of specifying target and property for Animation, use the on keyword, followed by the name of a property name for which the animation is to be a value source. For example, to animate the rotation property of an object with a NumberAnimation object, the following code can be used:

NumberAnimation ...

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.