O'Reilly logo

Game Programming using Qt 5 Beginner's Guide - Second Edition by Lorenz Haas, Witold Wysota, Pavel Strakhov

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

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 ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required