当前位置: 首页 > news >正文

css动画水球图

由于echarts水球图动画会导致ios卡顿,所以纯css模拟

展示效果

组件

<template><div class="water-box"><div class="water"><div class="progress" :style="{ '--newProgress': newProgress + '%' }"></div><div class="num">{{ parseFloat(text).toFixed(2) + '%' }}</div></div></div>
</template>
<script>
export default {name: 'Water',props: {progress: {type: Number,default: 0},text: {type: Number,default: 0}},data() {return {newProgress: 0}},mounted() {this.newProgress = this.progress > 100 ? 100 : this.progress},watch: {progress(val) {this.newProgress = val > 100 ? 100 : val}}
}
</script><style scoped lang="scss">
.water-box {width: 100px;height: 100px;border-radius: 50%;border: 1px solid #4c5259;background: linear-gradient(180deg, #171c25 0%, #313741 49.79%, #171c25 100%);box-shadow: 0 2px 10px 0 rgba(255, 255, 255, 0.25);display: flex;align-items: center;justify-content: center;.water {position: relative;display: flex;justify-content: center;align-items: center;width: 87.5px;height: 87.5px;border-radius: 50%;&::after {content: '';position: absolute;left: 0;right: 0;bottom: 0;border: 1px solid #313741;background: linear-gradient(135deg, #04bdf8 30.52%, #01e7af 100%, #01e4b4 100%);border-radius: 50%;top: 0;}.progress {width: 100%;height: 100%;text-align: center;color: #fff;line-height: 125px;position: absolute;left: 0;top: 0;border-radius: 50%;z-index: 1;overflow: hidden;&::before,&::after {content: '';position: absolute;left: -50%;width: 200px;height: 200px;}&::before {background-color: #313741;opacity: 0.8;border-radius: 40% 30%;animation: rotate1 10s linear infinite;}&::after {background-color: #313741;opacity: 0.7;border-radius: 42% 40%;animation: rotate2 10s linear infinite;}}@keyframes rotate1 {0% {transform: rotate(0deg);bottom: var(--newProgress); /*控制进度*/}100% {transform: rotate(360deg);bottom: var(--newProgress);}}@keyframes rotate2 {0% {transform: rotate(45deg);bottom: var(--newProgress);}100% {transform: rotate(360deg);bottom: var(--newProgress);}}.num {z-index: 2;color: #fff;font-size: 18px;font-weight: 500;}}
}
</style>

引用

<water:progress="66":text="66"
/>

http://www.lryc.cn/news/525723.html

相关文章:

  • 【设计模式-行为型】状态模式
  • 2024.1.22 安全周报
  • idea修改模块名导致程序编译出错
  • root用户Linux银河麒麟服务器安装vnc服务
  • CentOS 7使用RPM安装MySQL
  • OpenCV imread函数读取图像__实例详解
  • 激光线扫相机无2D图像的标定方案
  • 【安当产品应用案例100集】034-安当KSP支持密评中存储数据的机密性和完整性
  • 08.七种排序算法实现(C语言)
  • Alibaba Spring Cloud 一 核心组件、特性
  • kafka学习笔记7 性能测试 —— 筑梦之路
  • HQChart使用教程30-K线图如何对接第3方数据45- DRAWRADAR数据结构
  • Java集合学习:HashMap的原理
  • ETLCloud在iPaas中的是关键角色?
  • Docker Hub 全面解析及应对策略
  • 第五天 Labview数据记录(5.1 INI配置文件读写)
  • 【算法】经典博弈论问题——巴什博弈 python
  • ES6语法
  • 窥探QCC518x-308x系列与手机之间的蓝牙HCI记录与分析 - 耳机篇
  • ubuntu k8s 1.31
  • Prometheus+grafana实践:Doris数据库的监控
  • 【豆包MarsCode蛇年编程大作战】花样贪吃蛇
  • 企业级流程架构设计思路-基于价值链的流程架构
  • AI编程工具使用技巧:在Visual Studio Code中高效利用阿里云通义灵码
  • 钉钉群机器人设置——python版本
  • 细说STM32F407单片机电源低功耗StandbyMode待机模式及应用示例
  • IOS 安全机制拦截 window.open
  • jmeter中对接口进行循环请求后获取相应数据
  • 【QT】-explicit关键字
  • 【深度学习】 自动微分