-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathMainPage.qml
370 lines (352 loc) · 10.7 KB
/
MainPage.qml
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
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
import QtQuick 2.7
import QtQuick.Controls 2.0
import QtQuick.Layouts 1.0
import QtGraphicalEffects 1.0
Rectangle {
id: imagePage
objectName: "imagePage"
color: "black"
function changeState(newState) {
// console.log("Current State:", state)
// console.log("New State:", newState)
imagePage.state = newState
}
Timer {
id: startOffTimer
interval: 1000
running: false
onTriggered: {
// console.log("startoffTimer stopping")
startOffTimer.stop()
appWindow.setImageState("fadeIn")
}
}
Image {
id: newBackgroundImage
anchors.verticalCenter: parent.verticalCenter
anchors.horizontalCenter: parent.horizontalCenter
source: mainWindow.currentImage
autoTransform: true
opacity: 0
}
FastBlur {
id: newBackgroundBlur
anchors.fill: newBackgroundImage
source: newBackgroundImage
radius: appWindow.blurValue
opacity: 0
// onOpacityChanged: // console.log("NEW IMAGE BLUR OPACITY CHANGED TO:", newBackgroundBlur.opacity, "state is:", imagePage.state)
}
Image {
id: oldBackgroundImage
anchors.verticalCenter: parent.verticalCenter
anchors.horizontalCenter: parent.horizontalCenter
source: mainWindow.oldImage
autoTransform: true
opacity: 0
}
FastBlur {
id: oldBackgroundBlur
anchors.fill: oldBackgroundImage
source: oldBackgroundImage
radius: appWindow.blurValue
opacity: 0
}
DropShadow {
id: imageDropShadow
horizontalOffset: appWindow.shadowOffset
verticalOffset: appWindow.shadowOffset
radius: 8.0
anchors.fill: foregroundImage
samples: 17
transparentBorder: true
color: "#80000000"
source: foregroundImage
opacity: 0
}
Image {
id: foregroundImage
anchors.fill: parent
anchors.rightMargin: 10 + appWindow.shadowOffset
anchors.leftMargin: 10 + appWindow.shadowOffset
anchors.bottomMargin: 10 + appWindow.shadowOffset
anchors.topMargin: 10 + appWindow.shadowOffset
fillMode: Image.PreserveAspectFit
opacity: 0
source: mainWindow.currentImage
autoTransform: true
}
states: [
State {
name: "Initialize"
PropertyChanges {
target: foregroundImage
source: "qrc:/images/black.png"
}
PropertyChanges {
target: foregroundImage
opacity: 1
}
PropertyChanges {
target: imageDropShadow
opacity: 1
}
PropertyChanges {
target: newBackgroundImage
source: mainWindow.nextImage
}
PropertyChanges {
target: newBackgroundBlur
opacity: 0
}
PropertyChanges {
target: oldBackgroundImage
source: "qrc:/images/black.png"
}
PropertyChanges {
target: oldBackgroundBlur
opacity: 1
}
StateChangeScript {
script: {
name: "InitializeScript"
// console.log("InitializeScript")
appWindow.loadNextImage()
changeState("ImageOut")
}
}
},
State {
name: "ImageOut"
PropertyChanges {
target: newBackgroundBlur
opacity: appWindow.backgroundOpacity/2
}
PropertyChanges {
target: oldBackgroundBlur
opacity: appWindow.backgroundOpacity/2
}
PropertyChanges {
target: foregroundImage
opacity: 0
}
PropertyChanges {
target: imageDropShadow
opacity: 0
}
},
State {
name: "ImageIn"
PropertyChanges {
target: newBackgroundBlur
opacity: 1
}
PropertyChanges {
target: oldBackgroundBlur
opacity: 0
}
PropertyChanges {
target: foregroundImage
opacity: 1
}
PropertyChanges {
target: imageDropShadow
opacity: 1
}
},
State {
name: "ImageDisplay"
PropertyChanges {
target: newBackgroundImage
source: mainWindow.currentImage
}
PropertyChanges {
target: oldBackgroundImage
source: mainWindow.oldImage
}
PropertyChanges {
target: imageTimer
running: true
}
PropertyChanges {
target: newBackgroundBlur
opacity: 0
}
PropertyChanges {
target: oldBackgroundBlur
opacity: 1
}
PropertyChanges {
target: foregroundImage
opacity: 1
}
PropertyChanges {
target: imageDropShadow
opacity: 1
}
StateChangeScript {
name: "ImageDisplayScript"
script: {
// console.log("ImageDisplayScript")
appWindow.loadNextImage()
}
}
},
State {
name: "ImageReset"
PropertyChanges {
target: imageTimer
running: false
}
PropertyChanges {
target: oldBackgroundBlur
opacity: 1
}
PropertyChanges {
target: newBackgroundBlur
opacity: 0
}
PropertyChanges {
target: newBackgroundImage
source: mainWindow.nextImage
}
},
State {
name: "ImageInterrupt"
PropertyChanges {
target: imageTimer
running: false
}
PropertyChanges {
target: oldBackgroundBlur
opacity: 1
}
PropertyChanges {
target: newBackgroundBlur
opacity: 0
}
PropertyChanges {
target: newBackgroundImage
source: mainWindow.nextImage
}
StateChangeScript {
name: "ImageInterruptScript"
script: {
mainWindow.oldImage = mainWindow.currentImage
}
}
}
]
transitions: [
Transition {
from: "*"
to: "Initialize"
ScriptAction {
scriptName: "InitializeScript"
}
},
Transition {
from: "*"
to: "ImageOut"
ParallelAnimation {
NumberAnimation {
target: newBackgroundBlur
property: "opacity"
duration: appWindow.backgroundTransitionDuration/2
easing.type: Easing.InQuad
}
NumberAnimation {
target: oldBackgroundBlur
property: "opacity"
duration: appWindow.backgroundTransitionDuration/2
easing.type: Easing.InQuad
}
NumberAnimation {
target: foregroundImage
property: "opacity"
duration: appWindow.backgroundTransitionDuration/2
easing.type: Easing.InOutQuad
}
NumberAnimation {
target: imageDropShadow
property: "opacity"
duration: appWindow.backgroundTransitionDuration/2
easing.type: Easing.InOutQuad
}
}
onRunningChanged: {
if((state=="ImageOut") && (!running)) {
mainWindow.currentImage = mainWindow.nextImage
changeState("ImageIn")
}
}
},
Transition {
from: "*"
to: "ImageIn"
ParallelAnimation {
NumberAnimation {
target: newBackgroundBlur
property: "opacity"
to: 1
duration: appWindow.backgroundTransitionDuration/2
easing.type: Easing.OutQuad
}
NumberAnimation {
target: oldBackgroundBlur
property: "opacity"
to: 0
duration: appWindow.backgroundTransitionDuration/2
easing.type: Easing.OutQuad
}
NumberAnimation {
target: foregroundImage
property: "opacity"
duration: appWindow.backgroundTransitionDuration/2
easing.type: Easing.InOutQuad
}
NumberAnimation {
target: imageDropShadow
property: "opacity"
duration: appWindow.backgroundTransitionDuration/2
easing.type: Easing.InOutQuad
}
}
onRunningChanged: {
if((state=="ImageIn") && (!running)) {
// console.log("ImageChangeScript")
mainWindow.oldImage = mainWindow.currentImage
changeState("ImageDisplay")
}
}
},
Transition {
from: "*"
to: "ImageDisplay"
ScriptAction{
scriptName: "ImageDisplayScript"
}
},
Transition {
from: "*"
to: "ImageReset"
onRunningChanged: {
// console.log("ImageResetScript")
changeState("ImageOut")
}
},
Transition {
from: "*"
to: "ImageInterrupt"
NumberAnimation {
targets: [newBackgroundBlur, oldBackgroundBlur, foregroundImage, imageDropShadow]
properties: "opacity"
duration: 100
}
onRunningChanged: {
// console.log("ImageInterruptScript")
changeState("ImageOut")
}
}
]
}