鸿蒙系统0字母动画,掘金拷贝过来的

本文章来自掘金https://juejin.cn/post/6979042510400126983

 <!DOCTYPE html>
<html>
<head>
 <meta charset="UTF-8">
 <meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
 <title>公众号:前端学不动</title>
 <style>
* {
  padding: 0;
  margin: 0;
}
html, body { height: 100% }
body {
  background: black;
  display: flex;
  align-items: center;
  justify-content: center
}
.ul {
  position: relative;
  width: 100px;
  height: 50px;
  padding: 10px;
  list-style: none;
  overflow: hidden
}
.ul:first-of-type {
  padding-bottom: 0
}
.ul:last-of-type {
  padding-top: 0;
  /* margin-top: -2px; */
  /* animation: container-move .1s 1.2s forwards */
}

.harmony {
  position: absolute;
  top: 10px;
  left: 10px;
  width: 70px;
  height: 70px;
  border: 15px solid white;
  border-radius: 50%;
  transform: translateY(50%);
  box-shadow: 0 0 6px white, inset 0 0 6px white;
  animation: move 1.2s forwards
}
.ul:last-of-type > .harmony {
  top: auto;
  bottom: 10px;
  transform: translateY(-50%);
  filter: url(#blur)
}

svg {
  width: 0;
  height: 0
}

@keyframes move {
  to { transform: none }
}

/* @keyframes container-move {
  to { margin-top: 0 }
} */
 </style>
  </head>
  <body>
  <div class="container">
<ul class="ul">
  <li class="harmony"></li>
</ul>
<ul class="ul">
  <li class="harmony"></li>
</ul>
  </div>

 <svg>
<filter id="blur">
  <feGaussianBlur in="SourceGraphic" stdDeviation="0 6"/>
</filter>
  <script>
const filter = document.querySelector('feGaussianBlur')

const clearFilter = () => {
  const value = parseFloat(filter.getAttribute('stdDeviation').split(' ')[1]) - 0.06
  
  if (value > 0) {
    filter.setAttribute('stdDeviation', `0 ${value}`)
    requestAnimationFrame(clearFilter)
  } else {
    return
  }
}

setTimeout(clearFilter, 1200)
</script>
</body>
 [添加链接描述](https://juejin.cn/post/6979042510400126983)</html>
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值