diff --git a/src/views/app/Home.vue b/src/views/app/Home.vue index 6ae8dfa..df3bf01 100644 --- a/src/views/app/Home.vue +++ b/src/views/app/Home.vue @@ -160,54 +160,58 @@ export default { } .home-container { //height: calc(100vh - 80px); - width: 1920px; height: calc(1080px - 100px); display: flex; position: relative; - + transform: translateZ(0); + backface-visibility: hidden; + will-change: transform, opacity; & .home-text { position: absolute; top: 40px; left: 60px; } - & .right-container { - //background: #fff; - //height: 100%; + .right-container { position: relative; flex: 1; - & .bolloon-comp { - transition: all 1s ease-in-out; + + .bolloon-comp { + transition: transform 1s ease-in-out; position: absolute; top: 200px; - //right: 460px; left: 800px; z-index: 11; animation: opcitys 4s ease-in-out forwards; + will-change: transform; // 提前通知浏览器优化 + backface-visibility: hidden; + transform: translateZ(0); // 启用 GPU 加速 + &.move { - left: 1490px; - top: 390px; + transform: translate(690px, 190px) translateZ(0); + /* 原来 left: 1490px; top: 390px; */ } - //margin-left: 500px; } - & .bottom-butterfly { + .bottom-butterfly { z-index: 10; position: absolute; - //bottom: 0; - height: 450px; - width: 100%; - //opacity: 0; - //animation: show-butterfly 1s ease-in-out forwards; bottom: 100px; left: -1000px; - margin-left: 650px; + margin-left: 650px; // 可以考虑移除或改为 transform + height: 450px; + width: 100%; + will-change: transform; + backface-visibility: hidden; + transform: translateZ(0); + &.move { - left: -900px; + transform: translate(100px, 0) translateZ(0); bottom: 100px; } + & * { - //zoom: 1.1; + //zoom: 1.1; // zoom 已废弃,不推荐使用 } } } @@ -228,15 +232,11 @@ export default { @keyframes show-butterfly { 0% { opacity: 0; - bottom: -450px; - left: -50%; - margin-left: 500px; + transform: translate(-850px, 450px) rotate(-10deg); } 100% { opacity: 1; - bottom: 50px; - left: -850px; - margin-left: 650px; + transform: translate(-850px, 0) rotate(0deg); } } @@ -247,96 +247,84 @@ export default { .red-container, .red-container2 { .red-box { - transition: all 1s ease-in-out; position: absolute; z-index: 98; cursor: pointer; + + /* GPU 加速 */ + transform: translateZ(0); + backface-visibility: hidden; + will-change: transform, opacity; + transition: transform 1s ease-in-out, opacity 1s ease-in-out; + & .r-icon { width: 164px; height: 175px; position: absolute; z-index: 99; + background-size: contain; + background-position: center; + background-repeat: no-repeat; } + & .r-ban { position: absolute; - background: url('../../assets/images/new/r-ban.png'); - background-repeat: no-repeat; - background-size: cover; - background-position: center; - content: ' '; + background: url('../../assets/images/new/r-ban.png') no-repeat center center / cover; width: 239px; height: 98px; left: -35px; top: 100px; - z-index: -1; + z-index: 0; + transition: background-image 0.5s ease-in-out, opacity 0.5s ease-in-out; } &:hover { - & .r-ban { - transition: all 1s ease-in-out; - background: url('../../assets/images/new/r-ban-hover.png'); - background-repeat: no-repeat; - background-size: cover; - background-position: center; + .r-ban { + background-image: url('../../assets/images/new/r-ban-hover.png'); + opacity: 0.9; } } + &.red-box-1 { animation: red1 1s ease-in-out forwards; - & .r-icon { - //width: 155px; - //height: 155px; - background: url('../../assets/images/new/r1.png'); - background-size: contain; - background-position: center; - background-repeat: no-repeat; + .r-icon { + background-image: url('../../assets/images/new/r1.png'); } } + &.red-box-2 { animation: red2 1s ease-in-out forwards; - & .r-icon { - //width: 229px; - //height: 135px; - background: url('../../assets/images/new/r2.png'); - background-size: contain; - background-position: center; - background-repeat: no-repeat; + .r-icon { + background-image: url('../../assets/images/new/r2.png'); } } + &.red-box-3 { - & .r-icon { - background: url('../../assets/images/new/r3.png'); - background-size: contain; - background-position: center; - background-repeat: no-repeat; - } animation: red3 1s ease-in-out forwards; + .r-icon { + background-image: url('../../assets/images/new/r3.png'); + } } + &.red-box-4 { - & .r-icon { - background: url('../../assets/images/new/r4.png'); - background-size: contain; - background-position: center; - background-repeat: no-repeat; - } animation: red4 1s ease-in-out forwards; + .r-icon { + background-image: url('../../assets/images/new/r4.png'); + } } + &.red-box-5 { - & .r-icon { - background: url('../../assets/images/new/r5.png'); - background-size: contain; - background-position: center; - background-repeat: no-repeat; - } animation: red5 1s ease-in-out forwards; - } - &.red-box-6 { - & .r-icon { - background: url('../../assets/images/new/r6.png'); - background-size: contain; - background-position: center; - background-repeat: no-repeat; + .r-icon { + background-image: url('../../assets/images/new/r5.png'); } + } + + &.red-box-6 { animation: red6 1s ease-in-out forwards; + .r-icon { + background-image: url('../../assets/images/new/r6.png'); + } } } } @@ -347,30 +335,31 @@ export default { z-index: 10; width: 164px; height: 175px; + // GPU 加速 + transform: translateZ(0); + backface-visibility: hidden; + will-change: transform, opacity; &.red-box-1 { - left: -200px; - top: 53%; animation: red1 1.5s ease-in-out forwards; + transform: translate(-200px, 500px) translateZ(0); } &.red-box-2 { - left: -200px; - top: 10%; animation: red2 1.5s ease-in-out forwards; + transform: translate(-100px, 100px) translateZ(0); } &.red-box-3 { - left: -200px; - top: 0; animation: red3 1.5s ease-in-out forwards; + transform: translate(-200px, 0) translateZ(0); } + &.red-box-4 { - right: 0; - top: 53%; animation: red4 1.5s ease-in-out forwards; + transform: translate(1920px, 0) translateZ(0); } + &.red-box-5 { - right: -200px; - top: 53%; animation: red5 1.5s ease-in-out forwards; + transform: translate(1920px, 500px) translateZ(0); } } &.redContainerMove { @@ -403,68 +392,75 @@ export default { .red-container2 { position: absolute; - //background: rgba(255, 255, 255, 0.5); width: 800px; height: 500px; - left: -800px; - top: -500px; opacity: 0; + z-index: 11; + // 初始位置使用 transform 替代 left/top + transform: translate(-800px, -500px); + will-change: transform, opacity; + backface-visibility: hidden; + & .red-box { z-index: 99; cursor: pointer; - width: 108px !important; + width: 108px; height: 100px; - animation: redContainerMoves 2 ease-in-out; - transition: all 2s ease-in-out; + animation: redContainerMoves 2s ease-in-out forwards; + transition: opacity 2s ease-in-out; opacity: 0; + // 子图标 & div:first-child { - width: 100px !important; + width: 100px; height: 100px; position: absolute; z-index: 99; } + // 背景遮罩 & .r-ban { + position: absolute; width: 178px; height: 75px; top: 55px; + background: url('../../assets/images/new/r-ban.png') no-repeat center / cover; } + // 每个红点定位使用 transform &.red-box-1 { - left: 200px !important; - top: 52% !important; - } - &.red-box-2 { - left: 330px !important; - top: 43% !important; - } - &.red-box-3 { - left: 580px !important; - top: 24% !important; - } - &.red-box-4 { - left: 450px !important; - top: 33% !important; + transform: translate(200px, 200px) !important; z-index: 11; } + + &.red-box-2 { + transform: translate(330px, 150px) !important; + z-index: 11; + } + + &.red-box-3 { + transform: translate(610px, 50px) !important; + z-index: 11; + } + + &.red-box-4 { + transform: translate(480px, 100px) !important; + z-index: 11; + } + &.red-box-5 { - left: 300px !important; - top: 75% !important; + transform: translate(300px, 280px) !important; } &.red-box-6 { - left: 450px !important; - top: 65% !important; + transform: translate(450px, 65%); } } + + // 显示动画触发类 &.redContainerMove { - left: -130px !important; - top: 200px !important; + transform: translate(-130px, 200px); opacity: 1; - //.red-box { - // animation: redContainerMovesLevel 1s ease-in-out; - //} } } @@ -543,68 +539,59 @@ export default { } } } - @keyframes red1 { 0% { - left: -200px; - top: 51%; + transform: translate(-200px, 500px) scale(0.9) translateZ(0); opacity: 0; } 100% { - left: 100px; - top: 51%; + transform: translate(100px, 500px) scale(1) translateZ(0); opacity: 1; z-index: 11; } } @keyframes red2 { 0% { - left: -200px; - top: 10%; + transform: translate(-100px, 100px) scale(0.9) translateZ(0); opacity: 0; } 100% { - left: 330px; - top: 32%; + transform: translate(250px, 300px) scale(1) translateZ(0); opacity: 1; z-index: 11; } } @keyframes red3 { 0% { - left: -200px; - top: 0; + transform: translate(-200px, 0) scale(0.9) translateZ(0); opacity: 0; } 100% { - left: 660px; - top: 28%; + transform: translate(560px, 300px) scale(1) translateZ(0); opacity: 1; z-index: 11; } } @keyframes red4 { 0% { - right: -230px; - top: 13%; + transform: translate(1920px, 0px) scale(0.9) translateZ(0); opacity: 0; } 100% { - right: 230px; - top: 23%; + transform: translate(1500px, 200px) scale(1) translateZ(0); opacity: 1; + z-index: 11; } } @keyframes red5 { 0% { - right: -200px; - top: 43%; + transform: translate(1920px, 500px) scale(0.9) translateZ(0); opacity: 0; } 100% { - right: 50px; - top: 50%; + transform: translate(1650px, 550px) scale(1) translateZ(0); opacity: 1; + z-index: 11; } } @keyframes red6 { @@ -622,77 +609,69 @@ export default { } @keyframes red1Level { 0% { - left: 100px; - top: 51%; + transform: translate(100px, 500px) scale(1) translateZ(0); opacity: 1; } 100% { - left: -200px; - top: 51%; + transform: translate(-200px, 500px) scale(0.9) translateZ(0); opacity: 0; + z-index: 11; } } @keyframes red2Level { 0% { - left: 330px; - top: 32%; + transform: translate(250px, 300px) scale(1) translateZ(0); opacity: 1; } 100% { - left: -200px; - top: 10%; + transform: translate(-100px, 100px) scale(0.9) translateZ(0); opacity: 0; + z-index: 11; } } @keyframes red3Level { 0% { - left: 660px; - top: 28%; + transform: translate(560px, 300px) scale(1) translateZ(0); opacity: 1; } 100% { - left: -200px; - top: 0; + transform: translate(-200px, 0) scale(0.9) translateZ(0); opacity: 0; + z-index: 11; } } @keyframes red4Level { 0% { - right: 230px; - top: 23%; + transform: translate(1500px, 200px) scale(1) translateZ(0); opacity: 1; } 100% { - right: -230px; - top: 13%; + transform: translate(1920px, 0px) scale(0.9) translateZ(0); opacity: 0; + z-index: 11; } } @keyframes red5Level { 0% { - right: 50px; - top: 50%; + transform: translate(1650px, 550px) scale(1) translateZ(0); opacity: 1; } 100% { - right: -200px; - top: 43%; + transform: translate(1920px, 500px) scale(0.9) translateZ(0); opacity: 0; + z-index: 11; } } @keyframes red6Level { 0% { - right: 240px; - top: 61%; + transform: translate(240px, 61%) scale(1) translateZ(0); opacity: 1; } 100% { - right: -200px; - top: 53%; + transform: translate(-200px, 53%) scale(0.9) translateZ(0); opacity: 0; } } - @keyframes redContainerMoves { 0% { left: 0; diff --git a/src/views/app/homeComponents/bolloon/index.vue b/src/views/app/homeComponents/bolloon/index.vue index bfaae47..0595363 100644 --- a/src/views/app/homeComponents/bolloon/index.vue +++ b/src/views/app/homeComponents/bolloon/index.vue @@ -26,10 +26,6 @@ export default { diff --git a/src/views/app/homeComponents/bottom-butterfly/index.vue b/src/views/app/homeComponents/bottom-butterfly/index.vue index a89d11a..5624d5e 100644 --- a/src/views/app/homeComponents/bottom-butterfly/index.vue +++ b/src/views/app/homeComponents/bottom-butterfly/index.vue @@ -11,7 +11,7 @@
-
-
-