summaryrefslogtreecommitdiffstats
path: root/examples/declarative/toys/dynamic/qml/PerspectiveItem.qml
blob: c04d3dc565f43cbbaf7f503ba7fff5064d6f4d9a (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
import Qt 4.7

Image {
    id: rootItem

    property bool created: false
    property string image 

    property double scaledBottom: y + (height + height*scale) / 2 
    property bool onLand: scaledBottom > window.height / 2

    source: image
    opacity: onLand ? 1 : 0.25
    scale: Math.max((y + height - 250) * 0.01, 0.3)
    smooth: true

    onCreatedChanged: {
        if (created && !onLand)
            rootItem.destroy();
        else
            z = scaledBottom;
    }

    onYChanged: z = scaledBottom;
}