水球展示——微信小程序

html

html 复制代码
     <view class="water">
        <view class="text">
          完成率{{list.finish}}%
        </view>
        <view class="img" style="height: {{list.finish}}%">
          <image src="../../image/water.jpg" mode="" />
          <image src="../../image/water2.jpg" mode="" />
          <image src="../../image/water.jpg" mode="" />
          <image src="../../image/water2.jpg" mode="" />
        </view>
      </view>

less

css 复制代码
// 水球样式
.water {
  margin-top: 20rpx;
  border: 2px solid #45affa;
  width: 200rpx;
  height: 200rpx;
  border-radius: 50%;
  overflow: hidden;
  position: relative;

  // 球内文字
  .text {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 100%;
    z-index: 1;
    text-align: center;
    color: rgb(255, 123, 0);
  }
// 波浪
  .img {
    display: flex;
    justify-content: start;
    width: 300%;
    background-color: #0096ff;
    //控制完成率显示 定义到行内样式动态修改
    height: 1%;
    position: absolute;
    bottom: 0;
    animation: water 2s linear infinite;

    image {
      width: 100%;
      height: 20rpx;
    }
  }
}

// 水波动画
@keyframes water {
  0% {
    transform: translateX(-300rpx);
  }

  100% {
    transform: translateX(-0rpx);
  }
}

js

获取数据赋值就行

相关推荐
雮尘1 天前
如何在非 Claude IDE (TARE、 Cursor、Antigravity 等)下使用 Agent Skills
前端·agent·ai编程
icebreaker1 天前
Weapp-vite:原生模式之外,多一种 Vue SFC 选择
前端·vue.js·微信小程序
icebreaker1 天前
重走 Vue 长征路 Weapp-vite:编译链路与 Wevu 运行时原理拆解
前端·vue.js·微信小程序
wuhen_n1 天前
代码生成:从AST到render函数
前端·javascript·vue.js
喝咖啡的女孩1 天前
浏览器前端指南
前端
wuhen_n1 天前
AST转换:静态提升与补丁标志
前端·javascript·vue.js
喝咖啡的女孩1 天前
浏览器前端指南-2
前端
cxxcode1 天前
从 V8 引擎视角理解微任务与宏任务
前端
destinying1 天前
性能优化之实战指南:让你的 Vue 应⽤跑得飞起
前端·javascript·vue.js
徐小夕1 天前
JitWord Office预览引擎:如何用Vue3+Node.js打造丝滑的PDF/Excel/PPT嵌入方案
前端·vue.js·github