mirror of
https://github.com/zen-browser/desktop.git
synced 2025-09-05 19:08:18 +00:00
feat: Wait for a new frame before animating workspace backgrounds, b=(no-bug), c=workspaces
This commit is contained in:
@@ -2098,7 +2098,7 @@ var gZenWorkspaces = new (class extends ZenMultiWindowFeature {
|
||||
}
|
||||
}
|
||||
document.documentElement.setAttribute('animating-background', 'true');
|
||||
if (shouldAnimate) {
|
||||
if (shouldAnimate && previousWorkspace) {
|
||||
let previousBackgroundOpacity = document.documentElement.style.getPropertyValue(
|
||||
'--zen-background-opacity'
|
||||
);
|
||||
@@ -2114,19 +2114,24 @@ var gZenWorkspaces = new (class extends ZenMultiWindowFeature {
|
||||
previousBackgroundOpacity = 0;
|
||||
}
|
||||
gZenThemePicker.previousBackgroundOpacity = previousBackgroundOpacity;
|
||||
animations.push(
|
||||
gZenUIManager.motion.animate(
|
||||
document.documentElement,
|
||||
{
|
||||
'--zen-background-opacity': [previousBackgroundOpacity, 1],
|
||||
},
|
||||
{
|
||||
type: 'spring',
|
||||
bounce: 0,
|
||||
duration: kGlobalAnimationDuration,
|
||||
}
|
||||
)
|
||||
);
|
||||
await new Promise((resolve) => {
|
||||
requestAnimationFrame(() => {
|
||||
animations.push(
|
||||
gZenUIManager.motion.animate(
|
||||
document.documentElement,
|
||||
{
|
||||
'--zen-background-opacity': [previousBackgroundOpacity, 1],
|
||||
},
|
||||
{
|
||||
type: 'spring',
|
||||
bounce: 0,
|
||||
duration: kGlobalAnimationDuration,
|
||||
}
|
||||
)
|
||||
);
|
||||
resolve();
|
||||
});
|
||||
});
|
||||
}
|
||||
for (const element of document.querySelectorAll('zen-workspace')) {
|
||||
if (element.classList.contains('zen-essentials-container')) {
|
||||
|
Reference in New Issue
Block a user