forked from Shinonome/dots-hyprland
fix timeout anim (hmm #215)
This commit is contained in:
@@ -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);
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user