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

Have a go hero – Animating the sun's rays

By now, you should be an animation expert. If you want to try your skills, here's a task for you. The following code can be applied to the sun object and will display very simple red rays emitted from the sun:

Item {     id: sunRays     property int count: 10     width: sunVisual.width     height: width     anchors.centerIn: parent     z: -1     Repeater {         model: sunRays.count         Rectangle {             color: "red"             rotation: index * 360 / sunRays.count             anchors.fill: parent         }    }} 

The result is shown on the following picture:

The goal is to animate the rays so that the overall effect looks good and fits the tune like style of the ...

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