vue 动态气泡 CSS 动态气泡

4 篇文章 0 订阅
3 篇文章 0 订阅

工作时,上图白色光影的的动态气泡光点动态显示。

本来规划canvas 绘制,或者threejs绘制,但是需要js添加计时器,做动态绘制气泡

由于页面大量出现这种动图,考虑性能问题用css3 实现 具体代码如下所示

<template>
  <div class="decorate">
    <div class="bubble-Box">
      <span class="bubble1 bubble"></span>
      <span class="bubble2 bubble"></span>
      <span class="bubble3 bubble"></span>
      <span class="bubble4 bubble"></span>
      <span class="bubble5 bubble"></span>
      <span class="bubble6 bubble"></span>
      <span class="bubble7 bubble"></span>
      <span class="bubble8 bubble"></span>
    </div>
    <img src="@/assets/images/normal.png" alt="" />
  </div>
</template>

<script setup lang="ts">
</script>

<style scoped lang="scss">
.decorate {
  width: 44px;
  height: 109px;
  position: relative;
  img {
    width: 44px;
    height: 109px;
  }
}
.bubble-Box {
  width: 16px;
  height: 24px;
  position: absolute;
  left: 14px;
  top: 5px;
//   overflow: hidden;
  // background: #f0f;
}
.bubble{
    width: 10px;
    height: 10px;
    transform: scale(0.2);
    border-radius: 50%;
    background-color: rgb(255, 255, 255,0);
    position: absolute;
    bottom: 1px;
    left: 1px;
}
.bubble1{
animation: decorateUp 3s 2s linear infinite;
}
.bubble2{
animation: decorateUprt 3s 2s cubic-bezier(0.075, 0.42, 0.85, 1) infinite;
}
.bubble3{
animation: decorateUp 3s 2s linear infinite;
}
.bubble4{
animation: decorateUp 3s 3s linear infinite;
}
.bubble5{
animation: decorateUprt 3s 3s cubic-bezier(0.075, 0.42, 0.85, 1) infinite;
}
.bubble6{
animation: decorateUp 3s 3s linear infinite;
}
.bubble7{
animation: decorateUp 3s 1s linear infinite;
}
.bubble8{
animation: decorateUprt 3s 1s cubic-bezier(0.075, 0.22, 0.65, 1) infinite;
}
@keyframes decorateUp {
    0%{
        left: 0px;
        bottom: -5px;
        background-color: rgb(255, 255, 255,0.5);
    }
    100% {
        left: 8px;
        bottom: 34px;
        background-color: rgb(255, 255, 250, 0);
    }
}
@keyframes decorateUprt {
    0%{
        left: 8px;
        bottom: -5px;
        background-color: rgb(255, 255, 255,0.5);
    }
    100% {
        left: 0px;
        bottom: 34px;
        background-color: rgb(255, 255, 250, 0);
    }
}
</style>

  • 1
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值