Remove reliance on QML timer - still need to fix non-circular emoji mask

This commit is contained in:
Zach Fox 2019-08-15 13:04:50 -07:00
parent dcae607cfb
commit 9ae5eba12a
2 changed files with 20 additions and 32 deletions

View file

@ -12,7 +12,7 @@ Item {
property int size: 200 // The size of the circle in pixel
property real arcBegin: 0 // start arc angle in degree
property real arcEnd: 270 // end arc angle in degree
property real arcEnd: 360 // end arc angle in degree
property real arcOffset: 0 // rotation
property bool isPie: false // paint a pie instead of an arc
property bool showBackground: false // a full circle as a background of the arc
@ -39,10 +39,10 @@ Item {
Behavior on arcEnd {
id: animationArcEnd
enabled: false
enabled: true
NumberAnimation {
duration: root.animationDuration
easing.type: Easing.InOutCubic
easing.type: Easing.OutQuad
}
}

View file

@ -94,16 +94,6 @@ Rectangle {
clip: true
color: simplifiedUI.colors.darkBackground
Image {
id: mainEmojiImage
width: 180
height: 180
anchors.centerIn: parent
source: ""
fillMode: Image.PreserveAspectFit
visible: false
}
Image {
id: mainEmojiLowOpacity
width: 180
@ -115,10 +105,20 @@ Rectangle {
visible: true
}
Image {
id: mainEmojiImage
width: 180
height: 180
anchors.centerIn: parent
source: ""
fillMode: Image.PreserveAspectFit
visible: false
}
// The overlay used during the pie timeout
ProgressCircle {
property int arcChangeSize: 15
id: progressCircle
animationDuration: 7000 // Must match `TOTAL_EMOJI_DURATION_MS` in `simplifiedEmoji.js`
anchors.centerIn: mainEmojiImage
size: mainEmojiImage.width * 2
opacity: 0.5
@ -127,7 +127,7 @@ Rectangle {
showBackground: false
isPie: true
arcBegin: 0
arcEnd: 0
arcEnd: 360
visible: false
}
@ -136,16 +136,6 @@ Rectangle {
source: mainEmojiImage
maskSource: progressCircle
}
Timer {
id: arcTimer
interval: 5000
repeat: true
running: false
onTriggered: {
progressCircle.arcEnd = ((progressCircle.arcEnd - progressCircle.arcChangeSize) > 0) ? (progressCircle.arcEnd - progressCircle.arcChangeSize) : 0;
}
}
}
Rectangle {
@ -283,16 +273,14 @@ Rectangle {
switch(message.method) {
case "beginCountdownTimer":
var degreesInCircle = 360;
progressCircle.arcEnd = degreesInCircle;
arcTimer.interval = message.data.interval;
progressCircle.arcChangeSize = degreesInCircle / (message.data.duration / arcTimer.interval);
arcTimer.start();
progressCircle.endAnimation = true;
progressCircle.arcEnd = 0;
root.isSelected = true;
break;
case "clearCountdownTimer":
progressCircle.arcEnd = 0;
arcTimer.stop();
progressCircle.endAnimation = false;
progressCircle.arcEnd = 360;
progressCircle.endAnimation = true;
root.isSelected = false;
break;
default: