效果图(由于是截图,看不出动态效果):
代码:
图片素材:
<template>
<div>
<div class="box">
<div class="ring-outer"></div>
<div class="ring-inner"></div>
<div class="avatar"></div>
</div>
</div>
</template>
<script>
export default {
data() {
return {};
},
methods: {},
created() {}
};
</script>
<style>
.box {
position: relative;
width: 220px;
height: 220px;
display: flex;
justify-content: center;
align-items: center;
}
.ring-inner {
height: 220px;
width: 220px;
position: absolute;
background: url('../assets/ring-inner.png') no-repeat;
background-size: 90%;
background-position: center;
animation: clockwise 3s linear infinite;
}
.ring-outer {
height: 220px;
width: 220px;
position: absolute;
background: url('../assets/ring-outer.png') no-repeat;
background-size: 100%;
background-position: center;
animation: anti-clockwise 3s linear infinite;
}
.avatar {
height: 160px;
width: 160px;
background: url('../assets/timg.jpg');
background-size: 166%;
background-position: center;
border-radius: 50%;
}
@keyframes clockwise {
100% {
transform: rotate(360deg);
}
}
@keyframes anti-clockwise {
0% {
transform: rotate(360deg);
}
}
</style>