本文实例为大家分享了CSS实现横向粒子变动加载动画的对应代码,供大家参考,具体内容如下

此处用到了CSS3动画animation属性的animation-fill-mode属性和animation-delay属性。

 ● animation-fill-mode属性规定动画在播放之前或之后,其动画效果是否可见。
        none:不改变默认行为。
        forwards:当动画完成后,保持最后一个属性值(在最后一个关键帧中定义)。
        backwards:在animation-delay所指定的一段时间内,在动画显示之前,应用开始属性值(在第一个关键帧
中定义)。
       both: 向前和向后填充模式都被应用。   

 ●  animation-delay属性定义动画何时开始。该属性允许负值,示例中延迟0.16s执行动画。         

CSS Code 复制内容到剪贴板 #loader7:before,      #loader 7: after,      #loader 7 {         border -radius: 50%;         width : 2.5em;         height : 2.5em;        -webkit-animation-fill-mode:  both ;        animation-fill-mode:  both ;        -webkit-animation: load7 1.8s infinite ease-in-out;        animation: load7 1.8s infinite ease-in-out;      }      #loader 7 {         margin 60px   50px ;         float left ;         font-size 10px ;         position relative ;         text-indent : -9999em;        -webkit-animation-delay: 0.16s;        animation-delay: 0.16s;      }      #loader 7: before {         left : -3.5em;      }      #loader 7: after {         left : 3.5em;        -webkit-animation-delay: 0.32s;        animation-delay: 0.32s;      }      #loader 7: before,      #loader 7: after {         content '' ;         position absolute ;         top : 0;      }      @-webkit-keyframes load7 {        0%,        80%,        100% {          box-shadow: 0 2.5em 0 -1.3em  #000000 ;        }        40% {          box-shadow: 0 2.5em 0 0  #000000 ;        }      }      @keyframes load7 {        0%,        80%,        100% {          box-shadow: 0 2.5em 0 -1.3em  #000000 ;        }        40% {          box-shadow: 0 2.5em 0 0  #000000 ;        }      }   

 以上就是本文的全部内容,希望对大家学习CSS样式进行加载有所帮助。