summaryrefslogtreecommitdiffstats
path: root/weather-qml/MostlySunny.qml
blob: 4970238cdced1a88dec11dcf00938a8c9ccdfd33 (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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
import Qt 4.6

ForecastView {
    id: root

    SmallCloud {
        id: cloud3
        x: scaledX(-7)
        y: scaledY(-800)
        finalY: scaledY(-540);
        type: isDay ? "cloud" : "cloud_rain"
    }

    SmallCloud {
        id: cloud2
        x: scaledX(399)
        y: scaledY(-800)
        finalY: scaledY(-409);
        type: isDay ? "cloud" : "cloud_rain"
    }

    HungItem {
        id: sun
        x: isDay ? scaledX(120) : scaledX(220)
        y: scaledY(-800)
        itemX: 0
        itemY:  isDay ? 200 : 180
        height:  isDay ? 500 : 440
        finalY: isDay ? scaledY(-198) : scaledY(-205)
        itemImage: isDay ? "images/sun.png" : "images/moon.png"
        lineImage: isDay ? "images/sun_line.png" : "images/moon_line.png"
    }

    MediumCloud {
        id: cloud1
        x: scaledX(-20)
        y: scaledY(-800)
        finalY: scaledY(-218)
        type: isDay ? "cloud" : "cloud_rain"
    }

    states : State {
        name: "final"
        PropertyChanges { target: sun; y: sun.finalY; }
        PropertyChanges { target: cloud1; y: cloud1.finalY; }
        PropertyChanges { target: cloud2; y: cloud2.finalY; }
        PropertyChanges { target: cloud3; y: cloud3.finalY; }
    }

    transitions: Transition {
        SequentialAnimation {
            ParallelAnimation {
               NumberAnimation { target: cloud1; properties: "y";
                                 easing.type: "OutBack"; duration: 500 }

               SequentialAnimation {
                   PauseAnimation { duration: 200 }
                   NumberAnimation { target: cloud2; properties: "y";
                                     easing.type: "OutBack"; duration: 500 }
               }

               SequentialAnimation {
                   PauseAnimation { duration: 400 }
                   NumberAnimation { target: cloud3; properties: "y";
                                     easing.type: "OutBack"; duration: 500 }
               }
            }

            NumberAnimation { target: sun; properties: "y";
                              easing.type: "OutBack"; duration: 500 }
        }
    }

    onPresent: { root.state = "final"; }
}