summaryrefslogtreecommitdiffstats
path: root/examples/demos
diff options
context:
space:
mode:
authorKai Köhne <kai.koehne@qt.io>2023-06-22 13:37:28 +0200
committerQt Cherry-pick Bot <cherrypick_bot@qt-project.org>2023-08-14 16:42:07 +0000
commit5013d865a774f1219a16c75c68cd396303593e5e (patch)
treee4327e5aa03a0b5fecb42d3f64d0b39d81470238 /examples/demos
parente47ba26be3f1222d6f51d2e5f3e6b5758c4d8bd6 (diff)
Dice: Extract calculation of 45degrees
Don't calculate this inside the for loop. Change-Id: I09d46e363325071086332d901235f0feeabbb474 Reviewed-by: Jonas Karlsson <jonas.karlsson@qt.io> (cherry picked from commit 0bc36e534e3497dbdee45b718f62120dfac3a30e) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
Diffstat (limited to 'examples/demos')
-rw-r--r--examples/demos/dice/DiceSpawner.qml3
1 files changed, 2 insertions, 1 deletions
diff --git a/examples/demos/dice/DiceSpawner.qml b/examples/demos/dice/DiceSpawner.qml
index e3f33bfaa..4bd755432 100644
--- a/examples/demos/dice/DiceSpawner.qml
+++ b/examples/demos/dice/DiceSpawner.qml
@@ -32,9 +32,10 @@ Node {
function spawnDice(numberOfDice, physicsMaterial) {
reset();
+ let degrees45 = Math.PI / 4;
for (var index = 0; index < numberOfDice; index++) {
let initialPosition
- = Qt.vector3d(0.11 * Math.cos(index / (Math.PI / 4)),
+ = Qt.vector3d(0.11 * Math.cos(index / degrees45),
index * 2.1, 0);
createDie(initialPosition, physicsMaterial);
}