From 73562b08f09641a5c2d31501ab4ed29744d5c1d8 Mon Sep 17 00:00:00 2001 From: Bryan Date: Sat, 3 Aug 2024 01:16:26 -0600 Subject: [PATCH] tweak animations --- messagecenter.app.js | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/messagecenter.app.js b/messagecenter.app.js index 2335f7f..92923dc 100644 --- a/messagecenter.app.js +++ b/messagecenter.app.js @@ -223,9 +223,8 @@ const showText = function(showAll) { const removeMessage = function() { const removeAndReset = () => { const id = msgBoxes[messageNum].msg.id; - const idx = Bangle.findIndex(m => m.id === id); + const idx = Bangle.MESSAGES.findIndex(m => m.id === id); Bangle.MESSAGES.splice(idx, 1); // remove from Bangle.MESSAGES - //Bangle.MESSAGES = Bangle.MESSAGES.filter(m => m.id !== id); // remove from Bangle.MESSAGES msgBoxes.splice(messageNum, 1); // remove from msgBoxes if (!msgBoxes.length) { Bangle.setUI(); @@ -268,9 +267,10 @@ const showText = function(showAll) { } firstTouch = true; return new Promise((resolve, _reject) => { + let multiplier = 1; let animate = () => { - msgBoxes[messageNum].yOffset -= step; - msgBoxes[messageNum + 1].yOffset -= step; + msgBoxes[messageNum].yOffset -= step * multiplier; + msgBoxes[messageNum + 1].yOffset -= step * multiplier; if (msgBoxes[messageNum + 1].yOffset <= 0) { if (!removeCurrent) { if (messageNum < msgBoxes.length) { @@ -285,6 +285,7 @@ const showText = function(showAll) { msgBoxes[messageNum].draw(); msgBoxes[messageNum + 1].draw(); drawFooter(); + multiplier *= 2; timeouts.animID = setTimeout(animate, delay); } }; @@ -300,9 +301,10 @@ const showText = function(showAll) { } firstTouch = true; return new Promise((resolve, _reject) => { + let multiplier = 1; let animate = () => { - msgBoxes[messageNum].yOffset += step; - msgBoxes[messageNum - 1].yOffset += step; + msgBoxes[messageNum].yOffset += step * multiplier; + msgBoxes[messageNum - 1].yOffset += step * multiplier; if (msgBoxes[messageNum - 1].yOffset >= 0) { if (!removeCurrent) { if (messageNum > 0) { @@ -317,6 +319,7 @@ const showText = function(showAll) { msgBoxes[messageNum].draw(); msgBoxes[messageNum - 1].draw(); drawFooter(); + multiplier *= 2; timeouts.animID = setTimeout(animate, delay); } };