summaryrefslogtreecommitdiffstats
path: root/examples/declarative/tutorials
diff options
context:
space:
mode:
authormae <qt-info@nokia.com>2010-07-08 15:49:23 (GMT)
committermae <qt-info@nokia.com>2010-07-08 16:34:25 (GMT)
commitb22a5e13003ff9f23b075284a1a1e0a6b0e46250 (patch)
tree178f70df43aa34851efd82b1286a472c3f1fd500 /examples/declarative/tutorials
parentd5d16b3d3304774df11f40df0206d90ed5f840de (diff)
downloadQt-b22a5e13003ff9f23b075284a1a1e0a6b0e46250.zip
Qt-b22a5e13003ff9f23b075284a1a1e0a6b0e46250.tar.gz
Qt-b22a5e13003ff9f23b075284a1a1e0a6b0e46250.tar.bz2
Follow -> Behavior
Replace the usages of Follows with Behaviors, update docs.
Diffstat (limited to 'examples/declarative/tutorials')
-rw-r--r--examples/declarative/tutorials/samegame/samegame4/content/BoomBlock.qml11
-rwxr-xr-xexamples/declarative/tutorials/samegame/samegame4/content/samegame.js7
2 files changed, 10 insertions, 8 deletions
diff --git a/examples/declarative/tutorials/samegame/samegame4/content/BoomBlock.qml b/examples/declarative/tutorials/samegame/samegame4/content/BoomBlock.qml
index 1f51e13..92c607f 100644
--- a/examples/declarative/tutorials/samegame/samegame4/content/BoomBlock.qml
+++ b/examples/declarative/tutorials/samegame/samegame4/content/BoomBlock.qml
@@ -49,11 +49,14 @@ Item {
//![1]
property bool spawned: false
- property int targetX: 0
- property int targetY: 0
- SpringFollow on x { to: targetX; spring: 2; damping: 0.2; enabled: spawned }
- SpringFollow on y { to: targetY; spring: 2; damping: 0.2 }
+ Behavior on x {
+ enabled: spawned;
+ SpringAnimation{ spring: 2; damping: 0.2 }
+ }
+ Behavior on y {
+ SpringAnimation{ spring: 2; damping: 0.2 }
+ }
//![1]
//![2]
diff --git a/examples/declarative/tutorials/samegame/samegame4/content/samegame.js b/examples/declarative/tutorials/samegame/samegame4/content/samegame.js
index 930a3d8..b1f427c 100755
--- a/examples/declarative/tutorials/samegame/samegame4/content/samegame.js
+++ b/examples/declarative/tutorials/samegame/samegame4/content/samegame.js
@@ -57,8 +57,7 @@ function createBlock(column, row) {
}
dynamicObject.type = Math.floor(Math.random() * 3);
dynamicObject.x = column * gameCanvas.blockSize;
- dynamicObject.targetX = column * gameCanvas.blockSize;
- dynamicObject.targetY = row * gameCanvas.blockSize;
+ dynamicObject.y = row * gameCanvas.blockSize;
dynamicObject.width = gameCanvas.blockSize;
dynamicObject.height = gameCanvas.blockSize;
dynamicObject.spawned = true;
@@ -128,7 +127,7 @@ function shuffleDown() {
} else {
if (fallDist > 0) {
var obj = board[index(column, row)];
- obj.targetY += fallDist * gameCanvas.blockSize;
+ obj.y += fallDist * gameCanvas.blockSize;
board[index(column, row + fallDist)] = obj;
board[index(column, row)] = null;
}
@@ -146,7 +145,7 @@ function shuffleDown() {
obj = board[index(column, row)];
if (obj == null)
continue;
- obj.targetX -= fallDist * gameCanvas.blockSize;
+ obj.x -= fallDist * gameCanvas.blockSize;
board[index(column - fallDist, row)] = obj;
board[index(column, row)] = null;
}