微信小程序纯css实现波浪效果

  • wxml
html 复制代码
<view class="container">
  <view class="head">
    
  </view>
</view>
  • wxss
html 复制代码
.container {
  width: 100vw;
  height: 100vh;
}

.head {
  position: relative;
  height: 400rpx;
  background-color: rgb(118, 218, 255);
  overflow: hidden;
}

.head::after {
  content: "";
  position: absolute;
  left: 50%;
  width: 1000rpx;
  height: 1000rpx;
  background-color: #fff;
  animation-name: rotate;
  animation-iteration-count: infinite;
  animation-timing-function: linear;
  bottom: 40rpx;
  opacity: .5;
  border-radius: 47%;
  animation-duration: 10s;
}

.head::before {
  content: "";
  position: absolute;
  left: 50%;
  width: 1000rpx;
  height: 1000rpx;
  background-color: #fff;
  animation-name: rotate;
  animation-iteration-count: infinite;
  animation-timing-function: linear;
  bottom: 100rpx;
  border-radius: 45%;
  animation-duration: 10s;
}

@keyframes rotate {
  0% {
    transform: translate(-50%, 0) rotateZ(0deg);
  }

  50% {
    transform: translate(-50%, -2%) rotateZ(180deg);
  }

  100% {
    transform: translate(-50%, 0%) rotateZ(360deg);
  }
}

效果

相关推荐
走粥7 小时前
clsx和twMerge解决CSS类名冲突问题
前端·css
m0_4628038811 小时前
“趣味运动会记分”功能教学指南
小程序
吠品12 小时前
CSS图片居中:Flexbox、Grid与Transform的完整指南
前端·css
天若有情67313 小时前
Canvas生成艺术|意外诞生的混沌风暴(附完整源码+GitHub部署)
前端·css·html·github·canvas·网页
阿珊和她的猫14 小时前
React 中 CSS 书写方式全解析
前端·css·react.js
网络安全学习库15 小时前
很喜欢Vue,但还是选择了React: AI时代的新考量
vue.js·人工智能·react.js·小程序·aigc·产品经理·ai编程
打瞌睡的朱尤15 小时前
CSS复习
前端·css
叱咤少帅(少帅)16 小时前
Uniapp开发pc端,小程序和APK
小程序·uni-app
我是伪码农17 小时前
JS考核复写
前端·javascript·css
lightqjx18 小时前
【前端】前端学习二之CSS
前端·css·学习·html