CSS实现水波球

使用CSS实现水波球效果(单个的水波球)
效果如下:
在这里插入图片描述

<template>
    <div class="indicator" ref="indicator" :style="`border-color:${borderCol}`">
        <span  class="text">{{ completion }}% </span>
        <!-- for="completion" --> 
        <div class="ball" :style="`top: ${topValue}%;background-color:${borderCol};`">
        </div>
     
    </div>
</template>
<script>
export default {
    name: 'Ball',
    components: {

    },
    mixins: [],
    props: {
        completion: {
            type: Number,
            default: 50
        },
        borderCol:{
            type: String,
            default: '#00A4F1'
        },
        index:{
            type: Number,
            default: 0
        }
    },
    computed:{
        topValue(){
            console.log("this.completion",this.completion);
            return 120 -this.completion;
        }
    },
    data() {
        return {

        }
    },
    watch: {
    },
    mounted() {
    },
    methods: {
       
    }
};
</script>
<style lang='less' scoped>
.indicator {
    --completion: 30%;
    --offset: 20px;
    --waterBck:#00AFFF;
    --borderCol:#00A4F1;
    height: 60px;
    width: 180px;
    position: relative;
    border-radius: 30px;
    border: 2px solid var(--borderCol);
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    padding-left: 10px;
    // background: white;

    .ball {
        display: block;
        width: 200px;
        height: 200px;
        content: "";
        background-color: var(--waterBck);
        border-radius: 40%;
        position: absolute;
        left: 50%;
        top: calc(100% - var(--completion) + var(--offset));
        translate: -50% 0;
        -webkit-animation: spin 5s linear infinite;
        animation: spin 8s linear infinite;
    }
}

output {
    z-index: 1;
    font-family: system-ui;
    font-size: 20px;
    color: #333;
}

// .indicator

@-webkit-keyframes spin {
    100% {
        rotate: 360deg;
    }
}

@keyframes spin {
    100% {
        rotate: 360deg;
    }
}
.text{
    z-index: 2;
    color: #ffffff;
    text-align: center;
    font-family: "Barlow";
    font-size: 16px;
    font-weight: 500;
    line-height: 36px;
}


</style>

相关推荐

  1. css实现拖拽悬浮组件

    2024-03-09 22:32:08       39 阅读
  2. Css实现边界碰撞回弹

    2024-03-09 22:32:08       57 阅读
  3. 用python实现大作战

    2024-03-09 22:32:08       40 阅读
  4. vue实现掉落

    2024-03-09 22:32:08       63 阅读
  5. css垂直水平居中的几种实现方式

    2024-03-09 22:32:08       56 阅读

最近更新

  1. docker php8.1+nginx base 镜像 dockerfile 配置

    2024-03-09 22:32:08       94 阅读
  2. Could not load dynamic library ‘cudart64_100.dll‘

    2024-03-09 22:32:08       101 阅读
  3. 在Django里面运行非项目文件

    2024-03-09 22:32:08       82 阅读
  4. Python语言-面向对象

    2024-03-09 22:32:08       91 阅读

热门阅读

  1. 【设计模式】设计模式概论

    2024-03-09 22:32:08       36 阅读
  2. react hook: useimperativeHandle

    2024-03-09 22:32:08       45 阅读
  3. markdown学习笔记

    2024-03-09 22:32:08       47 阅读
  4. spring aop中获取request和response

    2024-03-09 22:32:08       43 阅读
  5. 基础算法(二)#蓝桥杯

    2024-03-09 22:32:08       39 阅读
  6. 外挂的本质以及进程相关的内容

    2024-03-09 22:32:08       41 阅读
  7. ElasticSearch聚合查询

    2024-03-09 22:32:08       35 阅读
  8. CSS 工程结构

    2024-03-09 22:32:08       48 阅读
  9. Pytest教程:Pytest参数化测试

    2024-03-09 22:32:08       50 阅读