What just happened?

For the instance of QPropertyAnimation created here, we define the item as a parent; thus, the animation will get deleted when the scene deletes the item, and we don't have to worry about freeing the used memory. Then, we define the target of the animation—our MyScene class—and the property that should be animated, jumpFactor, in this case. Then, we define the start and the end value of that property; in addition to that, we also define a value in between, by setting setKeyValueAt(). The first argument of the qreal type defines time inside the animation, where 0 is the beginning and 1 the end, and the second argument defines the value that the animation should have at that time. So your jumpFactor element will get animated ...

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.