分享一个波浪线动态效果
HTML代码
<div class="dynamic_wave">
<svg class="dynamic_wave_svg"
xmlns="http://www.w3.org/2000/svg"
xmlns:xlink="http://www.w3.org/1999/xlink"
viewBox="0 24 150 28"
preserveAspectRatio="none">
<defs>
<path id="gentle-wave" d="M-160 44c30 0 58-18 88-18s 58 18 88 18 58-18 88-18 58 18 88 18 v44h-352z" />
</defs>
<g class="dynamic_wave_g">
<use xlink:href="#gentle-wave" x="50" y="0" fill="#aae3ff"/>
<use xlink:href="#gentle-wave" x="50" y="3" fill="#ff969e"/>
<use xlink:href="#gentle-wave" x="50" y="6" fill="#a7ff98"/>
</g>
</svg>
</div>
<style type='text/css'>
.dynamic_wave_g>use {
animation: move-forever 12s linear infinite;
}
.dynamic_wave_g>use:nth-child(1) {
animation-delay: -2s;
}
.dynamic_wave_g>use:nth-child(2) {
animation-delay: -2s;
animation-duration: 5s;
}
.dynamic_wave_g>use:nth-child(3) {
animation-delay: -4s;
animation-duration: 3s;
}
@keyframes move-forever {
0% {transform: translate(-90px, 0%);}
100% {transform: translate(85px, 0%);}
}
.dynamic_wave {
width: 100%;
height: 40px;
position: relative;
overflow: hidden;
z-index: 1;
background: var(--footer-bg);
}
.dynamic_wave_svg {
display: block;
width: 100%;
height: 40px;
margin: 0;
}
</style>
- 其中
#aae3ff
#ff969e
#a7ff98
可替换成自己喜欢的颜色
效果
共有 0 条评论