欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页  >  web前端

基于轻量级高性能的CSS3动画库

程序员文章站 2022-03-26 12:37:41
...
  简要教程

  Repaintless.css是一款轻量级高性能的CSS3动画库。Repaintless.css通过特殊的方法来制作元素动画,不会引起页面的重绘,使它比其它CSS动画库具有更高的性能。


基于轻量级高性能的CSS3动画库


  安装

  你可以通过bower或npm来安装Repaintless.css。


$ bower install repaintless
$ npm install repaintless     

  

  使用方法

  使用该CSS3动画库需要在页面中引入repaintless.css文件。


  

  HTML结构

  要使一个元素可以动画,你需要做的就是为该元素添加element-animated class,这个是必须添加的class类,然后使用第二个class类来指明你需要的动画类型。


I tremble!

  

  默认情况下动画的时间是1秒钟。你可以通过class short来指定动画时间为0.5秒,long为2秒。如果你需要做无穷动画,可以添加infinite class。


I am quick!
I am slooow...
I will do that forever to drive you crazy!

  

  动画类型

  Repaintless.css所有可用的动画类型如下。某些动画是会一直循环的动画。

  slide-from-top

  slide-from-bottom

  slide-from-left

  slide-from-right

  slide-from-right-bottom

  slide-from-right-top

  slide-from-left-bottom

  slide-from-left-top

  slide-top-bottom (looped)

  slide-left-right (looped)

  tremble (looped)

  fade-in

  fade-out

  pulsate (looped)

  rotate

  Repaintless.css动画库的github地址为:https://github.com/szynszyliszys/repaintless


  来源:http://www.htmleaf.com/css3/css3donghua/201603073189.html