otimizacoes de performance em aparelhos moveis
Signed-off-by: Rodrigo Bertoldo de Sousa Martins <rodrigo.sousa.577@gmail.com>
This commit is contained in:
1 parent
21191aa9cf
commit
eaa68245d0
1 file changed
+121
-67
+121
-67
@@ -24,6 +24,15 @@
|
|||||||
padding: 0;
|
padding: 0;
|
||||||
box-sizing: border-box;
|
box-sizing: border-box;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Otimização de renderização para elementos animados */
|
||||||
|
*[class*="icon"],
|
||||||
|
*[class*="button"],
|
||||||
|
*[class*="modal"] {
|
||||||
|
backface-visibility: hidden;
|
||||||
|
-webkit-font-smoothing: antialiased;
|
||||||
|
-moz-osx-font-smoothing: grayscale;
|
||||||
|
}
|
||||||
|
|
||||||
body {
|
body {
|
||||||
font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
|
font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
|
||||||
@@ -39,7 +48,7 @@
|
|||||||
contain: layout style;
|
contain: layout style;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Background animado com gradiente */
|
/* Background animado com gradiente - otimizado */
|
||||||
body::before {
|
body::before {
|
||||||
content: '';
|
content: '';
|
||||||
position: fixed;
|
position: fixed;
|
||||||
@@ -47,11 +56,12 @@
|
|||||||
left: 0;
|
left: 0;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
height: 100%;
|
height: 100%;
|
||||||
background: linear-gradient(45deg, #20337b, #1a2a5e, #2d4a9e, #1e3470, #20337b);
|
background: linear-gradient(45deg, #20337b, #1a2a5e, #2d4a9e);
|
||||||
background-size: 400% 400%;
|
background-size: 200% 200%;
|
||||||
animation: gradientAnimation 15s ease infinite;
|
animation: gradientAnimation 20s ease-in-out infinite;
|
||||||
z-index: -2;
|
z-index: -2;
|
||||||
will-change: background-position;
|
will-change: transform;
|
||||||
|
transform: translate3d(0, 0, 0);
|
||||||
contain: strict;
|
contain: strict;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -117,10 +127,11 @@
|
|||||||
border-radius: 50px;
|
border-radius: 50px;
|
||||||
font-size: 0.95em;
|
font-size: 0.95em;
|
||||||
font-weight: bold;
|
font-weight: bold;
|
||||||
transition: all 0.3s ease;
|
transition: transform 0.2s ease, box-shadow 0.2s ease;
|
||||||
box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
|
box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
border: none;
|
border: none;
|
||||||
|
transform: translate3d(0, 0, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
.save-contact {
|
.save-contact {
|
||||||
@@ -129,9 +140,8 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
.save-contact:hover {
|
.save-contact:hover {
|
||||||
transform: translateY(-3px);
|
transform: translate3d(0, -3px, 0);
|
||||||
box-shadow: 0 6px 20px rgba(0, 0, 0, 0.4);
|
box-shadow: 0 6px 20px rgba(0, 0, 0, 0.4);
|
||||||
background: linear-gradient(135deg, #2d4a9e, #20337b);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.icons-row {
|
.icons-row {
|
||||||
@@ -149,34 +159,35 @@
|
|||||||
align-items: center;
|
align-items: center;
|
||||||
text-decoration: none;
|
text-decoration: none;
|
||||||
color: white;
|
color: white;
|
||||||
transition: transform 0.3s ease;
|
transition: transform 0.2s ease;
|
||||||
position: relative;
|
position: relative;
|
||||||
|
transform: translate3d(0, 0, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
.icon-item:hover {
|
.icon-item:hover {
|
||||||
transform: scale(1.08);
|
transform: scale3d(1.08, 1.08, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
.icon-box {
|
.icon-box {
|
||||||
width: 65px;
|
width: 65px;
|
||||||
height: 65px;
|
height: 65px;
|
||||||
background: rgba(255, 255, 255, 0.1);
|
background: rgba(255, 255, 255, 0.15);
|
||||||
backdrop-filter: blur(10px);
|
|
||||||
border-radius: 12px;
|
border-radius: 12px;
|
||||||
display: flex;
|
display: flex;
|
||||||
justify-content: center;
|
justify-content: center;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
margin-bottom: 8px;
|
margin-bottom: 8px;
|
||||||
border: 2px solid rgba(255, 255, 255, 0.2);
|
border: 2px solid rgba(255, 255, 255, 0.2);
|
||||||
transition: all 0.3s ease;
|
transition: background 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
|
||||||
position: relative;
|
position: relative;
|
||||||
z-index: 1;
|
z-index: 1;
|
||||||
|
transform: translate3d(0, 0, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
.icon-item:hover .icon-box {
|
.icon-item:hover .icon-box {
|
||||||
background: rgba(255, 255, 255, 0.2);
|
background: rgba(255, 255, 255, 0.25);
|
||||||
border-color: rgba(255, 255, 255, 0.4);
|
border-color: rgba(255, 255, 255, 0.4);
|
||||||
box-shadow: 0 8px 20px rgba(0, 0, 0, 0.3);
|
box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25);
|
||||||
}
|
}
|
||||||
|
|
||||||
.icon-box svg,
|
.icon-box svg,
|
||||||
@@ -215,24 +226,24 @@
|
|||||||
width: 0;
|
width: 0;
|
||||||
height: 0;
|
height: 0;
|
||||||
border-radius: 50%;
|
border-radius: 50%;
|
||||||
background: rgba(255, 255, 255, 0.3);
|
background: rgba(255, 255, 255, 0.2);
|
||||||
transform: translate(-50%, -50%);
|
transform: translate3d(-50%, -50%, 0);
|
||||||
transition: width 0.6s, height 0.6s;
|
transition: transform 0.4s ease, opacity 0.4s ease;
|
||||||
|
opacity: 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
.pix-button:hover::before {
|
.pix-button:hover::before {
|
||||||
width: 300px;
|
transform: translate3d(-50%, -50%, 0) scale(3);
|
||||||
height: 300px;
|
opacity: 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
.pix-button:hover {
|
.pix-button:hover {
|
||||||
transform: translateY(-3px);
|
transform: translate3d(0, -3px, 0);
|
||||||
box-shadow: 0 6px 20px rgba(0, 0, 0, 0.4);
|
box-shadow: 0 6px 20px rgba(0, 0, 0, 0.4);
|
||||||
background: linear-gradient(135deg, #00A86B, #32BCAD);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.pix-button:active {
|
.pix-button:active {
|
||||||
transform: translateY(-1px) scale(0.98);
|
transform: translate3d(0, -1px, 0) scale(0.98);
|
||||||
}
|
}
|
||||||
|
|
||||||
.modal {
|
.modal {
|
||||||
@@ -246,17 +257,17 @@
|
|||||||
z-index: 1000;
|
z-index: 1000;
|
||||||
justify-content: center;
|
justify-content: center;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
transition: background 0.3s ease;
|
transition: opacity 0.25s ease;
|
||||||
|
opacity: 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
.modal.active {
|
.modal.active {
|
||||||
display: flex;
|
display: flex;
|
||||||
animation: fadeIn 0.3s ease forwards;
|
animation: fadeIn 0.25s ease forwards;
|
||||||
}
|
}
|
||||||
|
|
||||||
@keyframes fadeIn {
|
@keyframes fadeIn {
|
||||||
0% { background: rgba(0, 0, 0, 0); }
|
to { background: rgba(0, 0, 0, 0.8); opacity: 1; }
|
||||||
100% { background: rgba(0, 0, 0, 0.8); }
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.modal-content {
|
.modal-content {
|
||||||
@@ -266,29 +277,26 @@
|
|||||||
max-width: 400px;
|
max-width: 400px;
|
||||||
width: 90%;
|
width: 90%;
|
||||||
box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
|
box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
|
||||||
transform: translateY(30px) scale(0.9);
|
transform: translate3d(0, 30px, 0) scale(0.9);
|
||||||
opacity: 0;
|
opacity: 0;
|
||||||
contain: layout style paint;
|
contain: layout style paint;
|
||||||
}
|
}
|
||||||
|
|
||||||
.modal.active .modal-content {
|
.modal.active .modal-content {
|
||||||
animation: slideUpScale 0.4s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
|
animation: slideUpScale 0.3s cubic-bezier(0.4, 0, 0.2, 1) forwards;
|
||||||
will-change: transform, opacity;
|
will-change: transform, opacity;
|
||||||
}
|
}
|
||||||
|
|
||||||
@keyframes slideUpScale {
|
@keyframes slideUpScale {
|
||||||
0% { transform: translateY(30px) scale(0.9); opacity: 0; }
|
to { transform: translate3d(0, 0, 0) scale(1); opacity: 1; }
|
||||||
100% { transform: translateY(0) scale(1); opacity: 1; }
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@keyframes fadeOut {
|
@keyframes fadeOut {
|
||||||
0% { background: rgba(0, 0, 0, 0.8); }
|
to { background: rgba(0, 0, 0, 0); opacity: 0; }
|
||||||
100% { background: rgba(0, 0, 0, 0); }
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@keyframes slideDownScale {
|
@keyframes slideDownScale {
|
||||||
0% { transform: translateY(0) scale(1); opacity: 1; }
|
to { transform: translate3d(0, 30px, 0) scale(0.9); opacity: 0; }
|
||||||
100% { transform: translateY(30px) scale(0.9); opacity: 0; }
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.modal-header {
|
.modal-header {
|
||||||
@@ -306,14 +314,13 @@
|
|||||||
border-radius: 10px;
|
border-radius: 10px;
|
||||||
margin-bottom: 20px;
|
margin-bottom: 20px;
|
||||||
text-align: center;
|
text-align: center;
|
||||||
transition: all 0.3s ease;
|
transition: border-color 0.2s ease, box-shadow 0.2s ease;
|
||||||
outline: none;
|
outline: none;
|
||||||
}
|
}
|
||||||
|
|
||||||
.modal-input:focus {
|
.modal-input:focus {
|
||||||
border-color: #32BCAD;
|
border-color: #32BCAD;
|
||||||
box-shadow: 0 0 0 3px rgba(50, 188, 173, 0.2);
|
box-shadow: 0 0 0 3px rgba(50, 188, 173, 0.2);
|
||||||
transform: scale(1.02);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.modal-buttons {
|
.modal-buttons {
|
||||||
@@ -329,9 +336,10 @@
|
|||||||
font-size: 1em;
|
font-size: 1em;
|
||||||
font-weight: bold;
|
font-weight: bold;
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
transition: all 0.3s ease;
|
transition: transform 0.15s ease, box-shadow 0.15s ease;
|
||||||
position: relative;
|
position: relative;
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
|
transform: translate3d(0, 0, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
.modal-button::after {
|
.modal-button::after {
|
||||||
@@ -339,17 +347,18 @@
|
|||||||
position: absolute;
|
position: absolute;
|
||||||
top: 50%;
|
top: 50%;
|
||||||
left: 50%;
|
left: 50%;
|
||||||
width: 0;
|
width: 100px;
|
||||||
height: 0;
|
height: 100px;
|
||||||
border-radius: 50%;
|
border-radius: 50%;
|
||||||
background: rgba(255, 255, 255, 0.4);
|
background: rgba(255, 255, 255, 0.3);
|
||||||
transform: translate(-50%, -50%);
|
transform: translate3d(-50%, -50%, 0) scale(0);
|
||||||
transition: width 0.5s, height 0.5s;
|
transition: transform 0.4s ease, opacity 0.4s ease;
|
||||||
|
opacity: 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
.modal-button:hover::after {
|
.modal-button:hover::after {
|
||||||
width: 300px;
|
transform: translate3d(-50%, -50%, 0) scale(3);
|
||||||
height: 300px;
|
opacity: 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
.modal-button.generate {
|
.modal-button.generate {
|
||||||
@@ -363,12 +372,12 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
.modal-button:hover {
|
.modal-button:hover {
|
||||||
transform: translateY(-2px);
|
transform: translate3d(0, -2px, 0);
|
||||||
box-shadow: 0 4px 10px rgba(0, 0, 0, 0.2);
|
box-shadow: 0 4px 10px rgba(0, 0, 0, 0.2);
|
||||||
}
|
}
|
||||||
|
|
||||||
.modal-button:active {
|
.modal-button:active {
|
||||||
transform: translateY(0) scale(0.98);
|
transform: translate3d(0, 0, 0) scale(0.98);
|
||||||
}
|
}
|
||||||
|
|
||||||
.pix-code-area {
|
.pix-code-area {
|
||||||
@@ -381,10 +390,10 @@
|
|||||||
font-family: monospace;
|
font-family: monospace;
|
||||||
font-size: 0.9em;
|
font-size: 0.9em;
|
||||||
color: #333;
|
color: #333;
|
||||||
transform: translateY(-10px);
|
transform: translate3d(0, -10px, 0);
|
||||||
opacity: 0;
|
opacity: 0;
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
transition: all 0.2s ease;
|
transition: background 0.15s ease, border-color 0.15s ease, transform 0.15s ease;
|
||||||
border: 2px solid transparent;
|
border: 2px solid transparent;
|
||||||
position: relative;
|
position: relative;
|
||||||
contain: layout style paint;
|
contain: layout style paint;
|
||||||
@@ -412,18 +421,17 @@
|
|||||||
.pix-code-area:hover {
|
.pix-code-area:hover {
|
||||||
background: #e8f5f3;
|
background: #e8f5f3;
|
||||||
border-color: #32BCAD;
|
border-color: #32BCAD;
|
||||||
transform: scale(1.02);
|
transform: translate3d(0, 0, 0) scale(1.01);
|
||||||
}
|
}
|
||||||
|
|
||||||
.pix-code-area.active {
|
.pix-code-area.active {
|
||||||
display: block;
|
display: block;
|
||||||
animation: slideInFade 0.4s ease forwards;
|
animation: slideInFade 0.3s ease forwards;
|
||||||
will-change: transform, opacity;
|
will-change: transform, opacity;
|
||||||
}
|
}
|
||||||
|
|
||||||
@keyframes slideInFade {
|
@keyframes slideInFade {
|
||||||
0% { transform: translateY(-10px); opacity: 0; }
|
to { transform: translate3d(0, 0, 0); opacity: 1; }
|
||||||
100% { transform: translateY(0); opacity: 1; }
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.copy-notification {
|
.copy-notification {
|
||||||
@@ -431,18 +439,17 @@
|
|||||||
color: #00A86B;
|
color: #00A86B;
|
||||||
font-weight: bold;
|
font-weight: bold;
|
||||||
display: none;
|
display: none;
|
||||||
transform: scale(0.8);
|
transform: scale3d(0.8, 0.8, 1);
|
||||||
opacity: 0;
|
opacity: 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
.copy-notification.active {
|
.copy-notification.active {
|
||||||
display: block;
|
display: block;
|
||||||
animation: popIn 0.3s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
|
animation: popIn 0.25s cubic-bezier(0.4, 0, 0.2, 1) forwards;
|
||||||
}
|
}
|
||||||
|
|
||||||
@keyframes popIn {
|
@keyframes popIn {
|
||||||
0% { transform: scale(0.8); opacity: 0; }
|
to { transform: scale3d(1, 1, 1); opacity: 1; }
|
||||||
100% { transform: scale(1); opacity: 1; }
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.small-icons {
|
.small-icons {
|
||||||
@@ -457,31 +464,70 @@
|
|||||||
.small-icon {
|
.small-icon {
|
||||||
width: 36px;
|
width: 36px;
|
||||||
height: 36px;
|
height: 36px;
|
||||||
background: rgba(255, 255, 255, 0.1);
|
background: rgba(255, 255, 255, 0.15);
|
||||||
backdrop-filter: blur(10px);
|
|
||||||
border-radius: 8px;
|
border-radius: 8px;
|
||||||
display: flex;
|
display: flex;
|
||||||
justify-content: center;
|
justify-content: center;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
border: 1px solid rgba(255, 255, 255, 0.2);
|
border: 1px solid rgba(255, 255, 255, 0.2);
|
||||||
transition: all 0.3s ease;
|
transition: transform 0.15s ease, background 0.15s ease, box-shadow 0.15s ease;
|
||||||
text-decoration: none;
|
text-decoration: none;
|
||||||
position: relative;
|
position: relative;
|
||||||
z-index: 1;
|
z-index: 1;
|
||||||
|
transform: translate3d(0, 0, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
.small-icon:hover {
|
.small-icon:hover {
|
||||||
background: rgba(255, 255, 255, 0.2);
|
background: rgba(255, 255, 255, 0.25);
|
||||||
transform: scale(1.15);
|
transform: scale3d(1.15, 1.15, 1);
|
||||||
box-shadow: 0 4px 10px rgba(0, 0, 0, 0.3);
|
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.25);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Suporte para dispositivos com preferência por movimento reduzido */
|
||||||
|
@media (prefers-reduced-motion: reduce) {
|
||||||
|
*,
|
||||||
|
*::before,
|
||||||
|
*::after {
|
||||||
|
animation-duration: 0.01ms !important;
|
||||||
|
animation-iteration-count: 1 !important;
|
||||||
|
transition-duration: 0.01ms !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
body::before {
|
||||||
|
animation: none !important;
|
||||||
|
background: #20337b;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Otimização para dispositivos touch (geralmente menos potentes) */
|
||||||
|
@media (pointer: coarse) {
|
||||||
|
/* Remove efeitos hover complexos em touch devices */
|
||||||
|
.pix-button::before,
|
||||||
|
.modal-button::after {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Simplifica sombras */
|
||||||
|
.icon-box,
|
||||||
|
.small-icon,
|
||||||
|
.save-contact,
|
||||||
|
.pix-button {
|
||||||
|
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Otimizações para telas menores e dispositivos menos potentes */
|
||||||
@media (max-width: 600px) {
|
@media (max-width: 600px) {
|
||||||
.header h1 { font-size: 1.5em; }
|
.header h1 { font-size: 1.5em; }
|
||||||
.header p { font-size: 0.8em; }
|
.header p { font-size: 0.8em; }
|
||||||
.icon-box { width: 60px; height: 60px; }
|
.icon-box { width: 60px; height: 60px; }
|
||||||
.icon-box svg { width: 28px; height: 28px; }
|
.icon-box svg { width: 28px; height: 28px; }
|
||||||
.icon-label { font-size: 0.65em; }
|
.icon-label { font-size: 0.65em; }
|
||||||
|
|
||||||
|
/* Reduz complexidade de animações em mobile */
|
||||||
|
body::before {
|
||||||
|
animation-duration: 25s;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
</head>
|
</head>
|
||||||
@@ -605,13 +651,19 @@
|
|||||||
|
|
||||||
const openPixModal = () => {
|
const openPixModal = () => {
|
||||||
pixModal.classList.add('active');
|
pixModal.classList.add('active');
|
||||||
setTimeout(() => pixValue.focus(), 100);
|
setTimeout(() => {
|
||||||
|
pixValue.focus();
|
||||||
|
// Remove will-change após animação completar
|
||||||
|
setTimeout(() => {
|
||||||
|
modalContent.style.willChange = 'auto';
|
||||||
|
}, 300);
|
||||||
|
}, 100);
|
||||||
};
|
};
|
||||||
|
|
||||||
const closePixModal = () => {
|
const closePixModal = () => {
|
||||||
const animStyle = (elem, anim) => elem.style.animation = anim;
|
const animStyle = (elem, anim) => elem.style.animation = anim;
|
||||||
animStyle(modalContent, 'slideDownScale 0.3s ease forwards');
|
animStyle(modalContent, 'slideDownScale 0.25s ease forwards');
|
||||||
animStyle(pixModal, 'fadeOut 0.3s ease forwards');
|
animStyle(pixModal, 'fadeOut 0.25s ease forwards');
|
||||||
|
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
pixModal.classList.remove('active');
|
pixModal.classList.remove('active');
|
||||||
@@ -620,7 +672,9 @@
|
|||||||
pixValue.value = '';
|
pixValue.value = '';
|
||||||
pixCodeArea.classList.remove('active');
|
pixCodeArea.classList.remove('active');
|
||||||
copyNotification.classList.remove('active');
|
copyNotification.classList.remove('active');
|
||||||
}, 300);
|
// Remove will-change para economizar recursos
|
||||||
|
modalContent.style.willChange = 'auto';
|
||||||
|
}, 250);
|
||||||
};
|
};
|
||||||
|
|
||||||
const generatePix = () => {
|
const generatePix = () => {
|
||||||
|
|||||||
Reference in new issue
Block a user