fix timeout anim (hmm #215)

This commit is contained in:
end-4
2024-02-03 07:30:44 +07:00
parent fb86c7316c
commit 9cf27e6d2c
2 changed files with 26 additions and 26 deletions
+13 -13
View File
@@ -83,22 +83,22 @@ export const AnimatedCircProg = ({
// Init animation
if (initFrom != initTo) {
// area.css = `font-size: ${initFrom}px; transition: ${initAnimTime}ms linear;`;
area.css = `font-size: ${initFrom}px; transition: ${initAnimTime}ms linear;`;
Utils.timeout(20, () => {
area.css = `font-size: ${initTo}px;`;
}, area)
// const transitionDistance = initTo - initFrom;
// const oneStep = initAnimTime / initAnimPoints;
// area.css = `
// font-size: ${initFrom}px;
// transition: ${oneStep}ms linear;
// `;
// for (let i = 0; i < initAnimPoints; i++) {
// Utils.timeout(Math.max(10, i * oneStep), () => {
// if(!area) return;
// area.css = `${initFrom != initTo ? 'font-size: ' + (initFrom + (transitionDistance / initAnimPoints * (i + 1))) + 'px;' : ''}`;
// });
// }
const transitionDistance = initTo - initFrom;
const oneStep = initAnimTime / initAnimPoints;
area.css = `
font-size: ${initFrom}px;
transition: ${oneStep}ms linear;
`;
for (let i = 0; i < initAnimPoints; i++) {
Utils.timeout(Math.max(10, i * oneStep), () => {
if(!area) return;
area.css = `${initFrom != initTo ? 'font-size: ' + (initFrom + (transitionDistance / initAnimPoints * (i + 1))) + 'px;' : ''}`;
});
}
}
else area.css = 'font-size: 0px;';
extraSetup(area);
+13 -13
View File
@@ -77,7 +77,7 @@ export default ({
isPopup = false,
props = {},
} = {}) => {
const popupTimeout = notifObject.urgency == 'critical' ? 8000 : 3000;
const popupTimeout = notifObject.timeout || (notifObject.urgency == 'critical' ? 8000 : 3000);
const command = (isPopup ?
() => notifObject.dismiss() :
() => notifObject.close()
@@ -435,17 +435,17 @@ export default ({
})
widget.add(notificationBox);
wholeThing.child.children = [widget];
if (isPopup) Utils.timeout(popupTimeout, () => {
if (wholeThing) {
wholeThing.revealChild = false;
Utils.timeout(200, () => {
if (wholeThing) {
wholeThing.destroy();
wholeThing = null;
}
command();
}, wholeThing);
}
})
// if (isPopup) Utils.timeout(popupTimeout, () => {
// if (wholeThing) {
// wholeThing.revealChild = false;
// Utils.timeout(200, () => {
// if (wholeThing) {
// wholeThing.destroy();
// wholeThing = null;
// }
// command();
// }, wholeThing);
// }
// })
return wholeThing;
}