blob: 720d2e64fcd39523b0abd6e01269ed8aa771365d (
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
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
|
import QtQuick 1.0
Rectangle {
width: 800; height: 720; color: "gray"
Rectangle {
id: rect
width: 50; height: 20; y: 30; color: "black"
SequentialAnimation on x {
loops: Animation.Infinite
NumberAnimation { from: 50; to: 700; duration: 1000 }
NumberAnimation { from: 700; to: 50; duration: 1000 }
}
}
Rectangle {
width: 50; height: 20; x: rect.x; y: 60; color: "red"
Behavior on x { SmoothedAnimation { velocity: 400 } }
}
Rectangle {
width: 50; height: 20; x: rect.x; y: 90; color: "yellow"
Behavior on x { SmoothedAnimation { velocity: 300; reversingMode: SmoothedAnimation.Immediate } }
}
Rectangle {
width: 50; height: 20; x: rect.x; y: 120; color: "green"
Behavior on x { SmoothedAnimation { velocity: 200; reversingMode: SmoothedAnimation.Sync } }
}
Rectangle {
width: 50; height: 20; x: rect.x; y: 150; color: "purple"
Behavior on x { SmoothedAnimation { velocity: 200; maximumEasingTime: 100 } }
}
Rectangle {
width: 50; height: 20; x: rect.x; y: 180; color: "blue"
Behavior on x { SmoothedAnimation { velocity: -1; duration: 300 } }
}
//rect2 has jerky movement, but the rects following it should be smooth
Rectangle {
id: rect2
property int dir: 1
width: 50; height: 20; x:50; y: 240; color: "black"
function advance(){
if(x >= 700)
dir = -1;
if(x <= 50)
dir = 1;
x += 130.0 * dir;
}
}
Timer{
interval: 200
running: true
repeat: true
onTriggered: rect2.advance();
}
Rectangle {
width: 50; height: 20; x: rect2.x; y: 270; color: "red"
Behavior on x { SmoothedAnimation { velocity: 400 } }
}
Rectangle {
width: 50; height: 20; x: rect2.x; y: 300; color: "yellow"
Behavior on x { SmoothedAnimation { velocity: 300; reversingMode: SmoothedAnimation.Immediate } }
}
Rectangle {
width: 50; height: 20; x: rect2.x; y: 330; color: "green"
Behavior on x { SmoothedAnimation { velocity: 200; reversingMode: SmoothedAnimation.Sync } }
}
Rectangle {
width: 50; height: 20; x: rect2.x; y: 360; color: "purple"
Behavior on x { SmoothedAnimation { velocity: 200; maximumEasingTime: 100 } }
}
Rectangle {
width: 50; height: 20; x: rect2.x; y: 390; color: "blue"
Behavior on x { SmoothedAnimation { velocity: -1; duration: 300 } }
}
//rect3 just jumps , but the rects following it should be smooth
Rectangle {
id: rect3
width: 50; height: 20; x:50; y: 480; color: "black"
function advance(){
if(x == 50)
x = 700;
else
x = 50;
}
}
Timer{
interval: 1000
running: true
repeat: true
onTriggered: rect3.advance();
}
Rectangle {
width: 50; height: 20; x: rect3.x; y: 510; color: "red"
Behavior on x { SmoothedAnimation { velocity: 400 } }
}
Rectangle {
width: 50; height: 20; x: rect3.x; y: 540; color: "yellow"
Behavior on x { SmoothedAnimation { velocity: 300; reversingMode: SmoothedAnimation.Immediate } }
}
Rectangle {
width: 50; height: 20; x: rect3.x; y: 570; color: "green"
Behavior on x { SmoothedAnimation { velocity: 200; reversingMode: SmoothedAnimation.Sync } }
}
Rectangle {
width: 50; height: 20; x: rect3.x; y: 600; color: "purple"
Behavior on x { SmoothedAnimation { velocity: 200; maximumEasingTime: 100 } }
}
Rectangle {
width: 50; height: 20; x: rect3.x; y: 630; color: "blue"
Behavior on x { SmoothedAnimation { velocity: -1; duration: 300 } }
}
}
|