效果图(由于是截图,看不出动态效果):

代码:
图片素材:


<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>
旋转动画效果实现
本文介绍了一个使用Vue.js创建的旋转动画效果,通过内外两个环形元素的相反方向旋转,配合中心头像,营造出视觉上的动态美感。文章提供了完整的代码示例,包括HTML结构、CSS动画及Vue组件定义。
1231

被折叠的 条评论
为什么被折叠?



