纯css实现超炫的加载动画效果

最近看了一下前端的相关技术,实现了一个纯css实现的动画效果,非常有意思,采用的是css3的相关知识。主要用的是@keyframes 和 animation两个知识点,代码量非常小。话不多说,直接上代码啦。

html代码非常的简单,就是两层div的嵌套




    
    
    
    Document
    


    

接下来是css代码

body{
    margin: 0;
    padding: 0;
    background: #2980b9;
}
.loading{
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%,-50%);
    height: 50px;
    display: flex;
    align-items: center;
}
.obj{
    width: 6px;
    height: 40px;
    background: white;
    margin: 0 3px;
    border-radius: 10px;
    animation: loading 0.8s infinite;
}
.obj:nth-child(2){
    animation-delay: 0.1s;
}
.obj:nth-child(3){
    animation-delay: 0.2s;
}
.obj:nth-child(4){
    animation-delay: 0.3s;
}
.obj:nth-child(5){
    animation-delay: 0.4s;
}
.obj:nth-child(6){
    animation-delay: 0.5s;
}
.obj:nth-child(7){
    animation-delay: 0.6s;
}
.obj:nth-child(8){
    animation-delay: 0.7s;
}
@keyframes loading{
    0%{
        height: 0px;
    }
    50%{
        height: 40px;
    }
    100%{
        height: 0;
    }
}

最后实现的效果截图不好操作,大家可以直接复制代码去实现。
纯css实现超炫的加载动画效果_第1张图片

你可能感兴趣的:(前端酷炫的动画效果实现,css,html,动画效果)