css实现五种loading加载动画效果代码
代码语言:html
所属分类:加载滚动
代码描述:css实现五种loading加载动画效果代码
下面为部分代码预览,完整代码请点击下载或在bfwstudio webide中打开
<html> <head> <style> html { height: 100%; } body { background: #222; height: 100%; display: -webkit-box; display: -webkit-flex; display: -ms-flexbox; display: flex; -webkit-box-pack: center; -webkit-justify-content: center; -ms-flex-pack: center; justify-content: center; -webkit-box-align: center; -webkit-align-items: center; -ms-flex-align: center; align-items: center; } .preload-1 { position: relative; margin-bottom: 40px; } .preload-1 span { display: block; position: absolute; bottom: 0px; width: 9px; height: 5px; background: coral; -webkit-animation: preload-1 1.5s infinite ease-in-out; animation: preload-1 1.5s infinite ease-in-out; } .preload-1 span:nth-child(2) { left: 11px; -webkit-animation-delay: .2s; animation-delay: .2s; } .preload-1 span:nth-child(3) { left: 22px; -webkit-animation-delay: .4s; animation-delay: .4s; } .preload-1 span:nth-child(4) { left: 33px; -webkit-animation-delay: .6s; animation-delay: .6s; } .preload-1 span:nth-child(5) { left: 44px; -webkit-animation-delay: .8s; animation-delay: .8s; } @-webkit-keyframes preload-1 { 0% { height: 5px; -webkit-transform: translateY(0px); transform: translateY(0px); background: coral; } 25% { height: 30px; -webkit-transform: translateY(15px); transform: translateY(15px); background: cornflowerblue; } 50% { height: 5px; -webkit-transform: translateY(0px); transform: translateY(0px); background: cornflowerblue; } 100% { height: 5px; -webkit-transform: translateY(0px); transform: translateY(0px); background: coral; } } @keyframes preload-1 { 0% { height: 5px; -webkit-transform: translateY(0px); transform: translateY(0px); background: coral; } 25% { height: 30px; -webkit-transform: translateY(15px); transform: translateY(15px); background: cornflowerblue; } 50% { height: 5px; -webkit-transform: translateY(0px); transform: translateY(0px); background: cornflowerblue; } 100% { height: 5px; -webkit-transform: translateY(0px); transform: translateY(0px); background: coral; } } .preload-2 { position: relative; left: 50%; margin-bottom: 40px; width: 40px; height: 40px; } .preload-2 span { position: absolute; display: block; bottom: 0px; width: 20px; height: 20px; background: #9b59b6; } .preload-2 span:nth-child(1) { -webkit-animation: preload-2-1 1.5s infinite ease-in-out; animation: preload-2-1 1.5s infinite ease-in-out; } .preload-2 span:nth-child(2) { left: 20px; -webkit-animation: preload-2-2 1.5s infinite ease-in-out; animation: preload-2-2 1.5s infinite ease-in-out; } .preload-2 span:nth-child(3) { top: 0px; -webkit-animation: preload-2-3 1.5s infinite ease-in-out; animation: preload-2-3 1.5s infinite ease-in-out; } .preload-2 span:nth-child(4) { top: 0px; left: 20px; -webkit-animation: preload-2-4 1.5s infinite ease-in-out; animation: preload-2-4 1.5s infinite ease-in-out; } @-webkit-keyframes preload-2-1 { 0% { -webkit-transform: translateX(0) translateY(0) rotate(0); transform: translateX(0) translateY(0) rotate(0); border-radius: 0; } 50% { -webkit-transform: translateX(-20px) translateY(-10px) rotate(-180deg); transform: translateX(-20px) translateY(-10px) rotate(-180deg); border-radius: 50%; background: #3498db; } 80% { -webkit-transform: translateX(0) translateY(0) rotate(-360deg); transform: translateX(0) translateY(0) rotate(-360deg); border-radius: 0; } 100% { -webkit-transform: translateX(0) translateY(0) rotate(-360deg); transform: translateX(0) translateY(0) rotate(-360deg); border-radius: 0; } } @keyframes preload-2-1 { 0% { -webkit-transform: translateX(0) translateY(0) rotate(0); transform: translateX(0) translateY(0) rotate(0); border-radius: 0; } 50% { -webkit-transform: translateX(-20px) translateY(-10px) rotate(-180deg); transform: translateX(-20px) translateY(-10px) rotate(-180deg); border-radius: 50%; background: #3498db; } 80% { -webkit-transform: translateX(0) translateY(0) rotate(-360deg); transform: translateX(0) translateY(0) rotate(-360deg); border-radius: 0; } 100% { -webkit-transform: translateX(0) translateY(0) rotate(-360deg); transform: translateX(0) translateY(0) rotate(-360deg); border-radius: 0; } } @-webkit-keyframes preload-2-2 { 0% { -webkit-transform: translateX(0px) translateY(0px) rotate(0deg); transform: translateX(0px) translateY(0px) rotate(0deg); border-radius: 0; } 50% { -webkit-transform: translateX(20px) translateY(-10px) rotate(180deg); transform: translateX(20px) translateY(-10px) rotate(180deg); border-radius: 50%; background: #f1c40f; } 80% { -webkit-transform: translateX(0) translateY(0) rotate(360deg); transform: translateX(0) translateY(0) rotate(360deg); border-radius: 0; } 100% { -webkit-transform: translateX(0) translateY(0) rotate(360deg); transform: translateX(0) translateY(0) rotate(360deg); border-radius: 0; } } @keyframes preload-2-2 { 0% { -webkit-transform: translateX(0px) translateY(0px) rotate(0deg); transform: translateX(0px) translateY(0px) rotate(0deg); border-radius: 0; } 50% { -webkit-transform: translateX(20px) translateY(-10px) rotate(180deg); transform: translateX(20px) translateY(-10px) rotate(180deg); border-radius: 50%; background: #f1c40f; } 80% { -webkit-transform: translateX(0) translateY(0) rotate(360deg); transform: translateX(0) translateY(0) rotate(360deg); border-radius: 0; } 100% { -webkit-transform: translateX(0) translateY(0) rotate(360deg); transform: translateX(0) translateY(0) rotate(360deg); border-radius: 0; } } @-webkit-keyframes preload-2-3 { 0% { -webkit-transform: translateX(0px) translateY(0px) rotate(0deg); transform: translateX(0px) translateY(0px) rotate(0deg); border-radius: 0; } 50% { -webkit-transform: translateX(-20px) translateY(10px) rotate(-180deg); transform: translateX(-20px) translateY(10px) rotate(-180deg); border-radius: 50%; background: #2ecc71; } 80% { -webkit-transform: translateX(0) translateY(0) rotate(-360deg); transform: translateX(0) translateY(0) rotate(-360deg); border-radius: 0; } 100% { -webkit-transform: translateX(0) translateY(0) rotate(-360deg); transform: translateX(0) translateY(0) rotate(-360deg); border-radius: 0; } } @keyframes preload-2-3 { 0% { -webkit-transform: translateX(0px) translateY(0px) rotate(0deg); transform: translateX(0px) translateY(0px) rotate(0deg); border-radius: 0; } .........完整代码请登录后点击上方下载按钮下载查看
网友评论0