summaryrefslogtreecommitdiffstats
path: root/examples/declarative/dynamic/qml/PerspectiveItem.qml
blob: a0dfad3da84b81c8b245e8708adb3286fe083911 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
import Qt 4.6

Image {
    id: tree
    property bool created: false
    property double scaleFactor: Math.max((y+height-250)*0.01, 0.3)
    property double scaledBottom: y + (height+height*scaleFactor)/2 
    property bool onLand: scaledBottom > window.height/2
    property string image //Needed for compatibility with GenericItem
    opacity: onLand ? 1 : 0.25
    onCreatedChanged: if (created && !onLand) { tree.destroy() } else { z = scaledBottom }
    scale: scaleFactor
    transformOrigin: "Center"
    source: image; smooth: true
    onYChanged: z = scaledBottom
}