-
Notifications
You must be signed in to change notification settings - Fork 0
/
PlayerPanel.qml
63 lines (59 loc) · 1.71 KB
/
PlayerPanel.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
import QtQuick
Rectangle {
id: playerPanel
property var primaryColor: "black"
property var secondaryColor
property Repeater cardRepeater: cardRepeater_
property SequentialAnimation animation: animation_
property bool isPlaying: false
color: primaryColor
border.color: "black"
border.width: 3
radius: width * .03
clip: false
// function stopAnimation() {
// animation_.running = false
// playerPanel.color = playerPanel.primaryColor
// }
// function startAnimation() {
// animation_.running = true
// }
SequentialAnimation {
id: animation_
running: false
loops: Animation.Infinite
PropertyAnimation { target: playerPanel; property: "color"; from: primaryColor; to: secondaryColor; duration: 300 }
PropertyAnimation { target: playerPanel; property: "color"; from: secondaryColor; to: primaryColor; duration: 100 }
onRunningChanged: {
if (!animation_.running) {
playerPanel.color = primaryColor
}
}
}
Row {
id: cardRow
anchors.left: parent.left
anchors.right: parent.right
anchors.top: parent.top
anchors.bottom: parent.bottom
anchors.leftMargin: parent.width * .04
anchors.rightMargin: parent.width * .04
anchors.topMargin: parent.height * .15
anchors.bottomMargin: parent.height * .15
spacing: 5
visible: isPlaying
Repeater {
id: cardRepeater_
model: 5
Card {
width: (cardRow.width - cardRow.spacing*4) / 5
height: cardRow.height*2
function getRandomCard() {
var cards = [ "1","2","3","4","5","7","8","10","11","12","Sorry" ]
return cards[Math.floor(Math.random()*cards.length)]
}
cardText: getRandomCard()
}
}
}
}