vue实现动态展示波浪效果
Sonder
2022-12-02
2330字
6分钟
浏览 (2.3k)
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>Document</title>
<link rel="stylesheet" href="https://cdn.suoluomei.com/common/js2.0/npm/vant@2.2/lib/index.css" />
<style>
.main {
position: relative;
align-items: center;
width: 180px;
height: 180px;
border-radius: 50%;
background-color: #12FFBE;
overflow: hidden;
border: 6px solid #c6ffed;
z-index: 100;
}
.wave {
position: absolute;
left: 50%;
width: 150vw;
height: 150vw;
background-color: #fff;
border-radius: 46%;
animation-duration: 6s;
animation-name: rotate;
animation-iteration-count: infinite;
animation-timing-function: linear;
}
@keyframes rotate {
0% {
transform: translate(-50%, 0) rotateZ(0deg);
}
50% {
transform: translate(-50%, -1%) rotateZ(180deg);
}
100% {
transform: translate(-50%, 0) rotateZ(360deg);
}
}
.slider {
width: 60%;
margin-top: 40px;
}
</style>
</head>
<body>
<div class="vue">
<div class="main">
<div class="wave" :style="{bottom:degree +'%'}"></div>
</div>
<div class="slider">
{{degree}}
<van-slider v-model="degree"> </van-slider>
</div>
</div>
</body>
<script src="https://cdn.suoluomei.com/common/js2.0/vue/v2.5.16/vue.js"></script>
<script src="https://cdn.suoluomei.com/common/js2.0/npm/vant@2.2/lib/vant.min.js"></script>
<script>
new Vue({
el: ".vue",
data: {
degree: 30
},
methods: {
}
})
</script>
</html>