summaryrefslogtreecommitdiffstats
path: root/examples
diff options
context:
space:
mode:
authorMartin Jones <martin.jones@nokia.com>2009-07-20 03:56:48 (GMT)
committerMartin Jones <martin.jones@nokia.com>2009-07-20 03:56:48 (GMT)
commit2d0e618db203d47bfe5bda50e9cf258a19e9745c (patch)
treed944f1546d2388ca1facec33012120e94097b61d /examples
parentbabb3bb4bb0de6cd2129d29fd6a90695bcbd53e2 (diff)
downloadQt-2d0e618db203d47bfe5bda50e9cf258a19e9745c.zip
Qt-2d0e618db203d47bfe5bda50e9cf258a19e9745c.tar.gz
Qt-2d0e618db203d47bfe5bda50e9cf258a19e9745c.tar.bz2
Add an inSync property that holds whether the target has "caught up"
Useful for determining when the target has finished animating.
Diffstat (limited to 'examples')
-rw-r--r--examples/declarative/follow/follow.qml17
-rw-r--r--examples/declarative/snow/snow.qml9
2 files changed, 20 insertions, 6 deletions
diff --git a/examples/declarative/follow/follow.qml b/examples/declarative/follow/follow.qml
index 21a0309..37a953c 100644
--- a/examples/declarative/follow/follow.qml
+++ b/examples/declarative/follow/follow.qml
@@ -40,11 +40,24 @@ Rect {
id: Mouse
anchors.fill: parent
Rect {
+ id: "Ball"
width: 20; height: 20
radius: 10
color: "#0000ff"
- x: Follow { source: Mouse.mouseX-10; spring: 1.0; damping: 0.05 }
- y: Follow { source: Mouse.mouseY-10; spring: 1.0; damping: 0.05 }
+ x: Follow { id: "F1"; source: Mouse.mouseX-10; spring: 1.0; damping: 0.05; epsilon: 0.25 }
+ y: Follow { id: "F2"; source: Mouse.mouseY-10; spring: 1.0; damping: 0.05; epsilon: 0.25 }
+ states: [
+ State {
+ name: "following"
+ when: !F1.inSync || !F2.inSync
+ SetProperties { target: Ball; color: "#ff0000" }
+ }
+ ]
+ transitions: [
+ Transition {
+ ColorAnimation { duration: 200 }
+ }
+ ]
}
}
}
diff --git a/examples/declarative/snow/snow.qml b/examples/declarative/snow/snow.qml
index 2b413bb..f65e0ac 100644
--- a/examples/declarative/snow/snow.qml
+++ b/examples/declarative/snow/snow.qml
@@ -27,11 +27,12 @@ Rect {
property real targetDeform: 0
property bool slowDeform: true
- property real deform
- deform: Follow { source: MyLayout.targetDeform; velocity: MyLayout.slowDeform?0.1:2 }
+ property real deform: 0
+ deform: Follow {
+ id: "DeformFollow"; source: MyLayout.targetDeform; velocity: MyLayout.slowDeform?0.1:2
+ onSyncChanged: if(inSync) { MyLayout.slowDeform = true; MyLayout.targetDeform = 0; }
+ }
- onDeformChanged: if(deform == targetDeform) { slowDeform = true; targetDeform = 0; }
-
ImageBatch { offset: 0; ref: ImagePanel }
x: Follow { source: MyLayout.targetX; velocity: 1000 }