summaryrefslogtreecommitdiffstats
path: root/examples/declarative/dynamic/qml/PerspectiveItem.qml
diff options
context:
space:
mode:
authorAlan Alpert <alan.alpert@nokia.com>2009-11-09 08:28:04 (GMT)
committerAlan Alpert <alan.alpert@nokia.com>2009-11-09 08:28:04 (GMT)
commit82566a4137e23ab73f7853d897e5702b686054cf (patch)
tree653817ba3e773c3804959722b0ad326df8279cca /examples/declarative/dynamic/qml/PerspectiveItem.qml
parentdbbe24f0f04e5a0aaf9223b73bee873e208a1fa7 (diff)
downloadQt-82566a4137e23ab73f7853d897e5702b686054cf.zip
Qt-82566a4137e23ab73f7853d897e5702b686054cf.tar.gz
Qt-82566a4137e23ab73f7853d897e5702b686054cf.tar.bz2
Fix perspective in dynamic example
working Z and items can no longer be placed in the sky (due to scaling).
Diffstat (limited to 'examples/declarative/dynamic/qml/PerspectiveItem.qml')
-rw-r--r--examples/declarative/dynamic/qml/PerspectiveItem.qml11
1 files changed, 7 insertions, 4 deletions
diff --git a/examples/declarative/dynamic/qml/PerspectiveItem.qml b/examples/declarative/dynamic/qml/PerspectiveItem.qml
index 55a70d5..728c3a5 100644
--- a/examples/declarative/dynamic/qml/PerspectiveItem.qml
+++ b/examples/declarative/dynamic/qml/PerspectiveItem.qml
@@ -3,10 +3,13 @@ import Qt 4.6
Image {
id: tree
property bool created: false
- opacity: y+height > window.height/2 ? 1 : 0.25
- onCreatedChanged: if (created && y+height<=window.height/2) { tree.destroy() }
- scale: y+height > window.height/2 ? (y+height-250)*0.01 : 1
+ 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
+ opacity: onLand ? 1 : 0.25
+ onCreatedChanged: if (created && !onLand) { tree.destroy() } else { z = scaledBottom }
+ scale: scaleFactor
transformOrigin: "Center"
source: image; smooth: true
- z: y
+ onYChanged: z = scaledBottom
}