☀️ 前言
相信大家经常会使用到加载动画,但是大部分组件库的加载样式都太简洁了👻。
这次给前端工友们收集了10+个高逼格加载动画效果!!复制就能直接用!!😎
⛷️ 来吧展示
1、一个"胶粘"加载
每个圆进行粘合拆分形成了一个胶粘效果
<!-- loading.html --> <div class="loading"> </div> <svg xmlns="http://www.w3.org/2000/svg" version="1.1"> <defs> <filter id="goo"> <feGaussianBlur in="SourceGraphic" stdDeviation="6.3" result="blur" /> <feColorMatrix in="blur" mode="matrix" values="1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 14 -4" result="goo" /> <feBlend in="SourceGraphic" in2="goo" /> </filter> </defs> </svg> 复制代码
/* loading.css */ .loading { width: 166px; height: 166px; position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); -webkit-filter: url("#goo"); filter: url("#goo"); } .loading span { width: 100%; text-align: center; color: #e04960; font-weight: bold; text-transform: uppercase; font-size: 15px; letter-spacing: 1px; position: absolute; left: 1px; top: 46%; } .loading:before, .loading:after { content: ''; border-radius: 50%; background-color: #e04960; width: 26px; height: 26px; position: absolute; left: 72px; top: 8px; animation: rotate 6s linear; animation-iteration-count: infinite; transform-origin: 12px 76px; } .loading:before { box-shadow: 45px 19px 0px 0px #e04960, 62px 63px 0px 0px #e04960, 45px 107px 0px 0px #e04960, 0px 126px 0px 0px #e04960, -46px 107px 0px 0px #e04960, -63px 63px 0px 0px #e04960, -46px 19px 0px 0px #e04960; } .loading:after { animation-direction: reverse; } @keyframes rotate { 0% { transform: rotate(0deg); } 100% { transform: rotate(-360deg); } }
Author:Dicson
2、一个"方块对对碰"加载
巧妙的运用位移也能做出碰撞挤出的效果
<!-- loading.html --> <div class="loading"> <div class="loading-square"></div> <div class="loading-square"></div> <div class="loading-square"></div> <div class="loading-square"></div> </div>
/* loading.css */ .loader { display: block; position: relative; height: 20px; width: 86px; } .loading-square { position: absolute; height: 20px; width: 20px; top: 0; } .loading-square:nth-child(1) { left: 0; animation: square1 1.5s linear forwards infinite; } .loading-square:nth-child(2) { left: 22px; animation: square2 1.5s linear forwards infinite; } .loading-square:nth-child(3) { left: 44px; animation: square3 1.5s linear forwards infinite; } .loading-square:nth-child(4) { left: 66px; animation: square4 1.5s linear forwards infinite; } @keyframes square1 { 0% { background-color: #97c900; transform: translate(0, 0); } 9.09091% { transform: translate(0, calc(-100% - 2px)); background-color: #97c900; } 18.18182% { transform: translate(calc(100% + 2px), calc(-100% - 2px)); background-color: #15668a; } 27.27273% { transform: translate(calc(100% + 2px), 0); } 100% { background-color: #15668a; transform: translate(calc(100% + 2px), 0); } } @keyframes square2 { 0% { background-color: #15668a; transform: translate(0, 0); } 18.18182% { transform: translate(0, 0); } 27.27273% { transform: translate(0, calc(100% + 2px)); background-color: #15668a; } 36.36364% { transform: translate(calc(100% + 2px), calc(100% + 2px)); background-color: #D53A33; } 45.45455% { transform: translate(calc(100% + 2px), 0); } 100% { background-color: #D53A33; transform: translate(calc(100% + 2px), 0); } } @keyframes square3 { 0% { background-color: #D53A33; transform: translate(0, 0); } 36.36364% { transform: translate(0, 0); } 45.45455% { transform: translate(0, calc(-100% - 2px)); background-color: #D53A33; } 54.54545% { transform: translate(calc(100% + 2px), calc(-100% - 2px)); background-color: #E79C10; } 63.63636% { transform: translate(calc(100% + 2px), 0); } 100% { background-color: #E79C10; transform: translate(calc(100% + 2px), 0); } } @keyframes square4 { 0% { transform: translate(0, 0); background-color: #E79C10; } 54.54545% { transform: translate(0, 0); } 63.63636% { transform: translate(0, calc(100% + 2px)); background-color: #E79C10; } 72.72727% { background-color: #D53A33; } 81.81818% { background-color: #15668a; } 90.90909% { transform: translate(calc(-300% - 6px), calc(100% + 2px)); background-color: #97c900; } 100% { transform: translate(calc(-300% - 6px), 0); background-color: #97c900; } }
Author:Paul Grant
3、一个"Switch"加载
有Switch的同学应该很熟悉了,这就是eshop里面的加载
<!-- loading.html --> <div class="load"> <div class="loading"> <div class="loader__bar"></div> <div class="loader__bar loader__bar--delay-1"></div> <div class="loader__bar loader__bar--delay-2"></div> <div class="loader__bar loader__bar--delay-3"></div> <div class="loader__bar loader__bar--delay-4"></div> <div class="loader__bar loader__bar--delay-5"></div> <div> </div> </div>
/* loading.css */ .load{ width: 400px; height: 170px; } @keyframes loader { 0%{ background: #FF8919; width:0%; }20%{ width:100%; }39%{ background: #FF8919; }40%{ background: #FFA54F; width: 0% }60%{ width: 100%; }80%{ width:0%; }100%{ background: #FFA54F; width: 0%; } } @keyframes loaderAlt { 0%{ background: #FF7C00; width:100%; }19%{ background: #FF7C00; }20%{ background: #FF9834; width: 0%; }40%{ width: 100%; }59%{ background: #FF9834; }60%{ background: #FF7C00; width: 0; }80%{ width: 100%; }100%{ background: #FF7C00; width: 100% } } .loading{ display: flex; flex-direction: column; height: 100%; position: relative; width: 100%; } .loader__bar{ display: flex; flex: 1; position: relative; width: 100%; } .loader__bar:before{ animation: loader ease 8s infinite; animation-delay: 100ms; background: #FF7C00; background-size: 200% 200%; content: ""; height:100%; width: 0%; } .loader__bar:after{ animation: loaderAlt ease 8s infinite; animation-delay: 100ms; background: #FF7C00; background-size: 200% 200%; content: ""; height: 100%; width: 100%; } .loader__bar--delay-1:before, .loader__bar--delay-1:after{ animation-delay: 200ms; } .loader__bar--delay-2:before, .loader__bar--delay-2:after{ animation-delay: 300ms; } .loader__bar--delay-3:before, .loader__bar--delay-3:after{ animation-delay: 400ms; } .loader__bar--delay-4:before, .loader__bar--delay-4:after{ animation-delay: 500ms; } .loader__bar--delay-5:before, .loader__bar--delay-5:after{ animation-delay: 600ms; }
Author:Steve Meredith
👋 写在最后
- 首先还是很感谢大家看到这里,这次的文章就分享到这里,如果有需要可以直接复制使用哟~
- 如果您觉得这篇文章有帮助到您的的话不妨🍉关注+点赞+收藏+评论+转发🍉支持一下哟~~😛您的支持就是我更新的最大动力。