微信小程序ColorUl组件中波浪动画的实现

编程入门 行业动态 更新时间:2024-10-28 15:30:28

微信小程序ColorUl组件中<a href=https://www.elefans.com/category/jswz/34/1769735.html style=波浪动画的实现"/>

微信小程序ColorUl组件中波浪动画的实现

ColorUI组件里的波浪动画怎么做的,其实很简单。先来看看效果

原理是三张图片通过动画滚动实现的
wxml代码:

  <view class="waveWrapper waveAnimation"><view class="waveWrapperInner bgTop"><view class="wave waveTop" style="background-image:url('.png')"></view></view><view class="waveWrapperInner bgMiddle"><view class="wave waveMiddle" style="background-image:url('.png')"></view></view><view class="waveWrapperInner bgBottom"><view class="wave waveBottom" style="background-image:url('.png')"></view></view></view>

图片只能是网络图片

wxss代码:

@keyframes move_wave {0% {transform: translateX(0) translateZ(0) scaleY(1);}50% {transform: translateX(-25%) translateZ(0) scaleY(1);}100% {transform: translateX(-50%) translateZ(0) scaleY(1);}
}.waveWrapper {overflow: hidden;position: relative;height: 50rpx;width: 100%;background: #39b54a;
}.waveWrapperInner {position: absolute;width: 100%;overflow: hidden;height: 100%;bottom: -1px;
}
.bgTop {z-index: 15;opacity: 0.5;height: 24px;
}.bgMiddle {z-index: 10;opacity: 0.75;height: 19px;
}.bgBottom {z-index: 5;height: 14px;
}.wave {position: absolute;left: 0;width: 2160px;height: 100%;background-repeat: repeat no-repeat;background-position: 0 bottom;transform-origin: center bottom;
}
.wave image {width: 100%;position: absolute;bottom: 0;
}.waveTop {background-size: 540px 25px;
}.waveAnimation .waveTop {animation: move_wave 30s linear infinite;
}.waveMiddle {background-size: 1080px 20px;
}.waveAnimation .waveMiddle {animation: move_wave 24s linear infinite;
}.waveBottom {background-size: 540px 15px;
}.waveAnimation .waveBottom {animation: move_wave 12s linear infinite;
}

基本上就已经实现了动画,改成相应底色就可以了。

更多推荐

微信小程序ColorUl组件中波浪动画的实现

本文发布于:2024-03-13 04:20:33,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1733171.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:波浪   组件   程序   动画   微信小

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!