一聚教程网:一个值得你收藏的教程网站

最新下载

热门教程

利用transition实现文字上下抖动的效果的教程

时间:2017-02-13 编辑:简简单单 来源:一聚教程网

实现思路

通过改变字母的top值

每个字母不能同时运动,通过延迟时间,for循环  2s (i*50)ms ...

infinite  动画会无限次地循环播放。

alternate  播放次数是奇数时,动画向原方向播放;播放次数是偶数时,动画向反方向播放

静态效果图

实例代码

 

 代码如下 复制代码

    

    

    

        @keyframes move{

            0%{

                top: 0;

            }

            100%{

                top: 10px;

            }

        }

        @-webkit-keyframes move{

            0%{

                top: 0;

            }

            100%{

                top: 10px;

            }

        }

        #box {

            width: 200px;

            height: 100px;

            background: red;

            font-size: 20px;

            color: #fff;

        }

        #box span {

            position: relative;

            /*animation: .2s move linear infinite alternate; */

        }

    

    

    L

    o

    a

    d

    i

    n

    g

 

热门栏目