mirror of
https://github.com/zen-browser/desktop.git
synced 2025-10-15 14:26:12 +00:00
feat: Better animations for app background, b=(no-bug), c=common, workspaces
This commit is contained in:
@@ -1,20 +1,18 @@
|
|||||||
diff --git a/browser/themes/linux/browser.css b/browser/themes/linux/browser.css
|
diff --git a/browser/themes/linux/browser.css b/browser/themes/linux/browser.css
|
||||||
index 5c9891e5ed4b865ed4ecc98d794a239b0f96a8f9..e13bf7277edeb49ebbb12cf9359ac6193bb47ebd 100644
|
index 5c9891e5ed4b865ed4ecc98d794a239b0f96a8f9..53e69289620dd7e89dad167fb3a59b162545dd89 100644
|
||||||
--- a/browser/themes/linux/browser.css
|
--- a/browser/themes/linux/browser.css
|
||||||
+++ b/browser/themes/linux/browser.css
|
+++ b/browser/themes/linux/browser.css
|
||||||
@@ -42,21 +42,25 @@
|
@@ -42,7 +42,8 @@
|
||||||
-moz-default-appearance: -moz-window-decorations;
|
-moz-default-appearance: -moz-window-decorations;
|
||||||
appearance: auto;
|
appearance: auto;
|
||||||
|
|
||||||
- #navigator-toolbox,
|
- #navigator-toolbox,
|
||||||
- dialog::backdrop {
|
|
||||||
+ #zen-main-app-wrapper,
|
+ #zen-main-app-wrapper,
|
||||||
+ dialog::backdrop,
|
+ #zen-browser-background,
|
||||||
+ #browser::after,
|
dialog::backdrop {
|
||||||
+ #browser::before {
|
|
||||||
border-top-left-radius: env(-moz-gtk-csd-titlebar-radius);
|
border-top-left-radius: env(-moz-gtk-csd-titlebar-radius);
|
||||||
border-top-right-radius: env(-moz-gtk-csd-titlebar-radius);
|
border-top-right-radius: env(-moz-gtk-csd-titlebar-radius);
|
||||||
}
|
@@ -50,13 +51,14 @@
|
||||||
|
|
||||||
/* stylelint-disable-next-line media-query-no-invalid */
|
/* stylelint-disable-next-line media-query-no-invalid */
|
||||||
@media -moz-pref("widget.gtk.rounded-bottom-corners.enabled") {
|
@media -moz-pref("widget.gtk.rounded-bottom-corners.enabled") {
|
||||||
@@ -27,8 +25,7 @@ index 5c9891e5ed4b865ed4ecc98d794a239b0f96a8f9..e13bf7277edeb49ebbb12cf9359ac619
|
|||||||
body,
|
body,
|
||||||
- dialog::backdrop {
|
- dialog::backdrop {
|
||||||
+ dialog::backdrop,
|
+ dialog::backdrop,
|
||||||
+ #browser::after,
|
+ #zen-browser-background {
|
||||||
+ #browser::before {
|
|
||||||
/* Use an uniform clip to allow WebRender to optimize it better */
|
/* Use an uniform clip to allow WebRender to optimize it better */
|
||||||
border-radius: env(-moz-gtk-csd-titlebar-radius);
|
border-radius: env(-moz-gtk-csd-titlebar-radius);
|
||||||
}
|
}
|
||||||
|
@@ -2,11 +2,21 @@
|
|||||||
var ZenStartup = {
|
var ZenStartup = {
|
||||||
init() {
|
init() {
|
||||||
this.openWatermark();
|
this.openWatermark();
|
||||||
|
this._initBrowserBackground();
|
||||||
this._changeSidebarLocation();
|
this._changeSidebarLocation();
|
||||||
this._zenInitBrowserLayout();
|
this._zenInitBrowserLayout();
|
||||||
this._initSearchBar();
|
this._initSearchBar();
|
||||||
},
|
},
|
||||||
|
|
||||||
|
_initBrowserBackground() {
|
||||||
|
const background = document.createXULElement('box');
|
||||||
|
background.id = 'zen-browser-background';
|
||||||
|
const grain = document.createXULElement('box');
|
||||||
|
grain.id = 'zen-browser-grain';
|
||||||
|
background.appendChild(grain);
|
||||||
|
document.getElementById('browser').prepend(background);
|
||||||
|
},
|
||||||
|
|
||||||
_zenInitBrowserLayout() {
|
_zenInitBrowserLayout() {
|
||||||
if (this.__hasInitBrowserLayout) return;
|
if (this.__hasInitBrowserLayout) return;
|
||||||
this.__hasInitBrowserLayout = true;
|
this.__hasInitBrowserLayout = true;
|
||||||
|
@@ -62,15 +62,6 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@keyframes zen-main-app-wrapper-animation {
|
|
||||||
from {
|
|
||||||
opacity: 1;
|
|
||||||
}
|
|
||||||
to {
|
|
||||||
opacity: 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@keyframes zen-jello-out-animation {
|
@keyframes zen-jello-out-animation {
|
||||||
0% {
|
0% {
|
||||||
transform: scale3d(1, 1, 1);
|
transform: scale3d(1, 1, 1);
|
||||||
|
@@ -32,14 +32,25 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
#browser {
|
#browser {
|
||||||
|
background: transparent !important;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
background: var(--zen-main-browser-background) !important;
|
}
|
||||||
|
|
||||||
|
#zen-browser-background {
|
||||||
|
width: 100%;
|
||||||
|
height: 100%;
|
||||||
|
position: absolute;
|
||||||
|
top: 0;
|
||||||
|
left: 0;
|
||||||
|
z-index: 0;
|
||||||
|
pointer-events: none;
|
||||||
|
|
||||||
will-change: background-color;
|
will-change: background-color;
|
||||||
|
|
||||||
&::after {
|
&::after,
|
||||||
|
&::before {
|
||||||
content: '';
|
content: '';
|
||||||
position: fixed;
|
position: absolute;
|
||||||
top: 0;
|
top: 0;
|
||||||
left: 0;
|
left: 0;
|
||||||
right: 0;
|
right: 0;
|
||||||
@@ -48,36 +59,38 @@
|
|||||||
pointer-events: none;
|
pointer-events: none;
|
||||||
}
|
}
|
||||||
|
|
||||||
&:not([post-animating='true'])::after {
|
@media -moz-pref('zen.theme.gradient') {
|
||||||
transition: background-color var(--inactive-window-transition);
|
&::after {
|
||||||
|
background: var(--zen-main-browser-background-old);
|
||||||
|
transition: 0s;
|
||||||
|
opacity: calc(1 - var(--zen-background-opacity));
|
||||||
|
}
|
||||||
|
|
||||||
|
&::before {
|
||||||
|
background: var(--zen-main-browser-background);
|
||||||
|
transition: 0s;
|
||||||
|
opacity: var(--zen-background-opacity);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@media -moz-pref('zen.theme.gradient') {
|
&:not([post-animating='true'])::before {
|
||||||
&[animating='true']::after {
|
transition: background-color var(--inactive-window-transition);
|
||||||
background: var(--zen-main-browser-background-old);
|
|
||||||
backdrop-filter: blur(5px);
|
|
||||||
animation: zen-main-app-wrapper-animation 0.4s ease forwards;
|
|
||||||
transition: 0s;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@media (not (-moz-windows-mica)) and -moz-pref('zen.view.grey-out-inactive-windows') {
|
@media (not (-moz-windows-mica)) and -moz-pref('zen.view.grey-out-inactive-windows') {
|
||||||
transition: color var(--inactive-window-transition);
|
transition: color var(--inactive-window-transition);
|
||||||
:root:not([zen-welcome-stage]) &:-moz-window-inactive {
|
:root:not([zen-welcome-stage]) &:-moz-window-inactive {
|
||||||
color: var(--toolbox-textcolor-inactive);
|
color: var(--toolbox-textcolor-inactive);
|
||||||
&::after {
|
&::before {
|
||||||
background-color: var(--toolbox-bgcolor-inactive);
|
background-color: var(--toolbox-bgcolor-inactive);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
&::before {
|
#zen-browser-grain {
|
||||||
content: '';
|
content: '';
|
||||||
position: fixed;
|
width: 100%;
|
||||||
top: 0;
|
height: 100%;
|
||||||
left: 0;
|
|
||||||
right: 0;
|
|
||||||
bottom: 0;
|
|
||||||
background-image: url(chrome://browser/content/zen-images/grain-bg.png);
|
background-image: url(chrome://browser/content/zen-images/grain-bg.png);
|
||||||
pointer-events: none;
|
pointer-events: none;
|
||||||
z-index: 0;
|
z-index: 0;
|
||||||
|
@@ -19,6 +19,8 @@
|
|||||||
--zen-border-radius: 7px;
|
--zen-border-radius: 7px;
|
||||||
--zen-primary-color: #ffb787;
|
--zen-primary-color: #ffb787;
|
||||||
|
|
||||||
|
--zen-background-opacity: 1;
|
||||||
|
|
||||||
/* Branding */
|
/* Branding */
|
||||||
--zen-branding-dark: #1d1d1d;
|
--zen-branding-dark: #1d1d1d;
|
||||||
--zen-branding-coral: #f76f53;
|
--zen-branding-coral: #f76f53;
|
||||||
|
@@ -1121,26 +1121,20 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const appWrapper = browser.document.getElementById('browser');
|
const appBackground = browser.document.getElementById('zen-browser-background');
|
||||||
if (!skipUpdate && !this._animatingBackground) {
|
if (!skipUpdate && !this._animatingBackground) {
|
||||||
this._animatingBackground = true;
|
this._animatingBackground = true;
|
||||||
appWrapper.removeAttribute('animating');
|
|
||||||
browser.document.documentElement.style.setProperty(
|
browser.document.documentElement.style.setProperty(
|
||||||
'--zen-main-browser-background-old',
|
'--zen-main-browser-background-old',
|
||||||
browser.document.documentElement.style.getPropertyValue('--zen-main-browser-background')
|
browser.document.documentElement.style.getPropertyValue('--zen-main-browser-background')
|
||||||
);
|
);
|
||||||
browser.window.requestAnimationFrame(() => {
|
browser.window.requestAnimationFrame(() => {
|
||||||
appWrapper.setAttribute('animating', 'true');
|
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
this._animatingBackground = false;
|
this._animatingBackground = false;
|
||||||
appWrapper.removeAttribute('animating');
|
appBackground.setAttribute('post-animating', 'true');
|
||||||
appWrapper.setAttribute('post-animating', 'true');
|
|
||||||
browser.document.documentElement.style.removeProperty(
|
|
||||||
'--zen-main-browser-background-old'
|
|
||||||
);
|
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
// Reactivate the transition after the animation
|
// Reactivate the transition after the animation
|
||||||
appWrapper.removeAttribute('post-animating');
|
appBackground.removeAttribute('post-animating');
|
||||||
}, 100);
|
}, 100);
|
||||||
}, 300);
|
}, 300);
|
||||||
});
|
});
|
||||||
|
@@ -2273,6 +2273,23 @@ var gZenWorkspaces = new (class extends ZenMultiWindowFeature {
|
|||||||
if (shouldAnimate) {
|
if (shouldAnimate) {
|
||||||
gZenUIManager._preventToolbarRebuild = true;
|
gZenUIManager._preventToolbarRebuild = true;
|
||||||
gZenUIManager.updateTabsToolbar();
|
gZenUIManager.updateTabsToolbar();
|
||||||
|
|
||||||
|
animations.push(
|
||||||
|
gZenUIManager.motion.animate(
|
||||||
|
document.documentElement,
|
||||||
|
{
|
||||||
|
'--zen-background-opacity': [
|
||||||
|
document.documentElement.style.getPropertyValue('--zen-background-opacity'),
|
||||||
|
'1',
|
||||||
|
],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
type: 'spring',
|
||||||
|
bounce: 0,
|
||||||
|
duration: kGlobalAnimationDuration,
|
||||||
|
}
|
||||||
|
)
|
||||||
|
);
|
||||||
}
|
}
|
||||||
await Promise.all(animations);
|
await Promise.all(animations);
|
||||||
if (shouldAnimate) {
|
if (shouldAnimate) {
|
||||||
|
Reference in New Issue
Block a user