forked from carlonluca/pot
-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.qml
196 lines (175 loc) · 4.78 KB
/
main.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
/*
* Project: PiOmxTextures
* Author: Luca Carlon
* Date: 11.01.2012
*
* Copyright (c) 2012, 2013 Luca Carlon. All rights reserved.
*
* This file is part of PiOmxTextures.
*
* PiOmxTextures is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* PiOmxTextures is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with PiOmxTextures. If not, see <http://www.gnu.org/licenses/>.
*/
import QtQuick 2.0
import com.luke.qml 1.0
Rectangle {
id: mainRectangle
property int indexVideo: 0
property int indexFlippable: 0
width: 1920
height: 1080
color: "red"
focus: true
Keys.onPressed: {
if (event.key === Qt.Key_S)
mediaProcessor.stop();
else if (event.key === Qt.Key_P)
mediaProcessor.play();
else if (event.key === Qt.Key_A)
mediaProcessor.pause();
}
Timer {
interval: 5000; running: true; repeat: true
onTriggered: {
indexVideo++;
var theState = indexVideo%4;
if (theState == 0)
mainRectangle.state = "LARGE";
else if (theState == 1)
mainRectangle.state = "NORMAL";
else if (theState == 2)
myFlip.showBack();
else if (theState == 3)
myFlip.showFront();
}
}
OMXMediaProcessor {
id: mediaProcessor
source: "/home/pi/usb/Cars2.mkv"
}
Flipable {
id: myFlip
x:50
y:50
width: 900
height: 600
function showFront() {
rot.angle = 0;
}
function showBack() {
rot.angle = 180;
}
transform: Rotation {
id: rot
origin.x: 400;
origin.y: 100;
axis.x: 0; axis.y: 1; axis.z: 0
angle: 0
Behavior on angle {PropertyAnimation{}}
}
front: OMXVideoSurface {
id: omxVideoSurface
width: 900
height: 600
x: 50
y: 50
source: mediaProcessor
SequentialAnimation {
id: theAnimation
PropertyAnimation {
target: omxVideoSurface
property: "opacity"
to: 0.0
duration: 1000
}
PropertyAnimation {
target: omxVideoSurface
property: "opacity"
to: 1.0
duration: 1000
}
}
}
back: Item {
Rectangle {
width: 800
height: 430
color: "green"
}
Text {
x: 30
y:200
text: "Turn for the cool side!"
font.pixelSize: 60
font.weight: Font.Bold
}
}
}
Image {
x: 1500
y: 100
width: 300
height: 300
source: "qrc:/resources/qt-logo.png"
opacity: 0.5
}
Text {
id: myMarquee
text: "Marquee effect here!"
x: 0
y: 900
font.pixelSize: 80
font.weight: Font.Bold
SequentialAnimation {
loops: Animation.Infinite
running: true
SmoothedAnimation {
target: myMarquee
property: "x"
from: 0
to: 1920
duration: 10000
}
}
}
states: [
State {
name: "NORMAL"
PropertyChanges {
target: omxVideoSurface
x: 50; y: 50; width: 900; height: 600;
}
PropertyChanges {
target: myFlip
x: 50; y: 50; width: 900; height: 600;
}
},
State {
name: "LARGE"
PropertyChanges {
target: omxVideoSurface;
x: 0; y: 0; width: 1920; height: 1080;
}
PropertyChanges {
target: myFlip
x: 0; y: 0; width: 1920; height: 1080;
}
}
]
transitions: [
Transition {
NumberAnimation {properties: "width,height"; duration: 800; easing.type: Easing.OutBounce}
NumberAnimation {properties: "x,y"; duration: 800}
}
]
}