动效优化

This commit is contained in:
aixianling
2022-09-07 17:38:57 +08:00
parent 8883aaceb1
commit 1b9c231a08
3 changed files with 52 additions and 43 deletions

View File

@@ -5,11 +5,11 @@
<h2>{{ title }}</h2> <h2>{{ title }}</h2>
<img class="right" src="https://cdn.cunwuyun.cn/dvcp/dv/img/display-icon.svg"> <img class="right" src="https://cdn.cunwuyun.cn/dvcp/dv/img/display-icon.svg">
</div> </div>
<component class="background" :is="type"/> <div class="displayPanel fill">
<div class="displayPanel"> <div class="animation abs-center">
<div class="animation">
<component class="item" v-for="(op,i) in list" :key="i" :is="item" v-bind="op" :style="{transform:getPos(i)}"/> <component class="item" v-for="(op,i) in list" :key="i" :is="item" v-bind="op" :style="{transform:getPos(i)}"/>
</div> </div>
<component class="content-background abs-center" :is="type"/>
</div> </div>
</section> </section>
</template> </template>
@@ -29,10 +29,6 @@ export default {
}, },
list: {default: () => []}, list: {default: () => []},
}, },
data () {
return {
}
},
methods: { methods: {
getPos(i) { getPos(i) {
let unit = this.list.length > 0 ? 2 * Math.PI / this.list.length : 0, let unit = this.list.length > 0 ? 2 * Math.PI / this.list.length : 0,
@@ -48,6 +44,15 @@ export default {
position: relative; position: relative;
width: 100%; width: 100%;
height: 100%; height: 100%;
display: flex;
flex-direction: column;
.abs-center {
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
}
.display-top { .display-top {
position: relative; position: relative;
@@ -96,17 +101,15 @@ export default {
} }
.displayPanel { .displayPanel {
position: absolute; position: relative;
width: 160px; transform-style: preserve-3d;
height: 160px;
transform: translate(-50%, -50%);
top: 50%;
left: 50%;
z-index: 9;
.animation { .animation {
animation: rotate3D 30s infinite linear; animation: rotate3D 30s infinite linear;
transform-style: preserve-3d; transform-style: preserve-3d;
width: 160px;
height: 160px;
margin-top: -50px;
&:hover { &:hover {
animation-play-state: paused; animation-play-state: paused;
@@ -115,16 +118,21 @@ export default {
.item { .item {
position: absolute; position: absolute;
transform-style: preserve-3d;
} }
} }
.content-background {
transform-style: preserve-3d;
}
} }
@keyframes rotate3D { @keyframes rotate3D {
from { from {
transform: rotateY(0deg); transform: translate(-50%, -50%) rotateX(-10deg) rotateY(0deg);
} }
to { to {
transform: rotateY(360deg); transform: translate(-50%, -50%) rotateX(-10deg) rotateY(360deg);
} }
} }

Binary file not shown.

Before

Width:  |  Height:  |  Size: 25 KiB

View File

@@ -2,48 +2,49 @@
<div class="display0"> <div class="display0">
<div class="display0-container"> <div class="display0-container">
<div class="display0-content"> <div class="display0-content">
<img src="https://cdn.cunwuyun.cn/dvcp/dv/img/display0-left.png"> <img class="leftBg" src="https://cdn.cunwuyun.cn/dvcp/dv/img/display0-left.png">
<img src="https://cdn.cunwuyun.cn/dvcp/dv/img/display0-left.png"> <img class="contentBg" src="https://cdn.cunwuyun.cn/dvcp/dv/img/display0-bg.png" alt=""/>
<img class="leftBg" src="https://cdn.cunwuyun.cn/dvcp/dv/img/display0-left.png">
</div> </div>
</div> </div>
</div> </div>
</template> </template>
<script> <script>
export default { export default {
name: 'display0', name: 'display0',
}
data () {
return {
}
}
}
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
.display0 { .display0 {
position: relative; //position: relative;
width: 840px; width: 840px;
height: 465px;
.display0-content {
display: flex;
position: absolute;
width: 100%;
height: 465px; height: 465px;
background: url(./../asset/display0-bg.png) no-repeat center; align-items: center;
justify-content: space-between;
background-size: cover; background-size: cover;
.display0-content {
display: flex;
position: absolute;
top: 50%;
width: 100%;
height: 465px;
transform: translateY(-50%);
align-items: center;
justify-content: space-between;
background: url(./../asset/display0-bg.png) no-repeat center;
background-size: cover;
img:last-child { .leftBg {
position: relative; position: absolute;
left: 0;
&:last-of-type {
left: unset;
right: 0;
transform: rotate(180deg); transform: rotate(180deg);
} }
} }
.contentBg{
transform-style: preserve-3d;
}
} }
}
</style> </style>