summaryrefslogtreecommitdiffstats
path: root/examples/declarative/dial/DialLibrary/Dial.qml
blob: fe8528d2ef0f42546536fa85d677a8b05e0ef890 (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
34
35
36
37
38
39
40
41
42
Item {
    width: 210
    height: 210
    properties: Property {
        name: "value"
        type: "real"
        value: 0
    }
    Image {
        id: Background
        source: "background.svg"
    }
    Item {
        x: 104
        y: 102
        rotation: Needle.rotation
        Image {
            source: "needle_shadow.svg"
            x: -104
            y: -102
        }
    }
    Item {
        id: Needle
        x: 102
        y: 98
        rotation: -130
        rotation: Follow {
            spring: 1.4
            damping: .15
            source: Math.min(Math.max(-130, value*2.2 - 130), 133)
        }
        Image {
            source: "needle.svg"
            x: -102
            y: -98
        }
    }
    Image {
        source: "overlay.svg"
    }
}