您当前的位置: 首页 >  动画

css 模糊加载动画的实现

发布时间:2022-10-12 12:16:09 ,浏览量:6

阅读目录
  • 阐述
    • index.html
    • index.js
    • index.css
阐述

JS实现的模糊加载动画效果,这个效果也是一个比较常见的效果,现在我们一起来看一下,今天练习的最终效果:

在这里插入图片描述

index.html
 load++ if (load > 99) { clearInterval(int) } loadText.innerText = `${load}%` loadText.style.opacity = scale(load, 0, 100, 1, 0) bg.style.filter = `blur(${scale(load, 0, 100, 30, 0)}px)` } const scale = (num, in_min, in_max, out_min, out_max) => { return ((num - in_min) * (out_max - out_min)) / (in_max - in_min) + out_min } 
index.css
* { box-sizing: border-box; } body { font-family: 'Ubuntu', sans-serif; display: flex; align-items: center; justify-content: center; height: 100vh; overflow: hidden; margin: 0; } .bg { background: url('./images/01.png') no-repeat center center/cover; position: absolute; top: -30px; left: -30px; width: calc(50vw + 60px); height: calc(50vh + 60px); z-index: -1; filter: blur(0px); } .loading-text { font-size: 50px; color: #fff; } 
关注
打赏
1688896170
查看更多评论

暂无认证

  • 6浏览

    0关注

    115984博文

    0收益

  • 0浏览

    0点赞

    0打赏

    0留言

私信
关注
热门博文
立即登录/注册

微信扫码登录

0.0815s