aboutsummaryrefslogtreecommitdiffstats
path: root/benchmarks/auto/animations/comparison/moving-images-script.qml
blob: 37b88f179d3a9096ecab707fe08f06acf1b417df (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
import QtQuick 2.2

Item {
    id: root;

    property int size: Math.sqrt(width * height / count);
    property string description: count + " " + size + "x" + size + " Image instances\nAnimation with JavaScript";
    property int count: 500
    property int staticCount: 20000

    Grid {
        width: root.width
        height: root.height
        columns: Math.ceil(root.width / root.size);
        rows: Math.ceil(root.height / root.size);
        Repeater {
            model: root.count
            Image {
                source: "../../../../shared/butterfly-wide.png"
                sourceSize: Qt.size(root.size, root.size);

                property real t;
                rotation: 10 * Math.sin(t * Math.PI * 2 + Math.PI);

                SequentialAnimation on t {
                    PauseAnimation { duration: 200 + Math.random() * 200 }
                    NumberAnimation { from: 0; to: 1; duration: 1000; }
                    loops: Animation.Infinite
                }
            }
        }
    }
}