图标元素动画效果

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
    <style type="text/css">
        
        *{
            padding: 0%;
            margin: 0%;
        }

        body{
            background: #8b8ab3;
            margin: 50px;
        }

        @font-face{
            font-family: 'icon-font';
            src: url('font/flat-ui-icons-regular.ttf'), url('font/flat-ui-icons-regular.eot'), url('font/flat-ui-icons-regular.woff'), url('font/flat-ui-icons-regular.svg');
        
        }
        .icon{
            background: white;
            border: none;
            border-radius: 50%;
            /* inline-block 使行内元素变为块元素 */
            display: inline-block;
            width: 100px;
            height: 100px;
            line-height: 100px;
            font-size: 0px;
            cursor: pointer;
            /*添加动画
            -webkit-animation:move 1s linear;
            animation:move 1s linear;
            */

            animation: move 1s cubic-bezier(.62,-0.91,.45,1.97);
            /*
                animate-full-mode 属性规定了元素在动画之外的状态时怎样的
                forward, 表示动画完成后保留最后一个关键帧中的属性
                backword, 表示动画延迟之前就使得元素应用第一个关键帧中的属性
                both,表示包括forward和backward的两种属性,此例中both和backward皆可
            */
            -webkit-animation-fill-mode: both;
            animation-fill-mode: both; /*backwards*/
        }
        /**为什么用before*/
        .icon::before{
            content:"\e609";
            font-family: 'icon-font';
            color: #8b8ab3;
            font-size: 50px;
         
           /*content之后通常添加display:block和width和height*/
            display: block; 
            text-align: center;
        }
        
        /* 定义图标
            定义图标的时候添加图标和content
        */
        .home::before{
            content: '\e62e';
        }
        .search::before{
            content: '\e630';
        }
        .user::before{
            content: '\e631';
        }
        .mail::before{
            content: '\e632';
        }
        .chat::before{
            content: '\e62d';
        }
        /*定义动画出现的时延*/
        .home{
            animation-delay: 0s;
        }
        .search{
            animation-delay: .1s;
        }
        .user{
            animation-delay: .2s;
        }
        .mail{
            animation-delay: .3s;
        }
        .chat{
            animation-delay: .4s;
        }

        /*定义动画出现的动作,在页面加载时就出现这些动作,所以把move加在icon上
            自定义动作名为move,之后用animate添加在icon中
        */

        @keyframes move{
            from{
                opacity: 0;
                transform: translateY(100%);
            }

            to{
                opacity: 1;
                transform: translateY(0%);
            }
        }
    </style>
</head>
<body>
<span class="home icon">Home</span>
<span class="search icon">Search</span>
<span class="user icon">User</span>
<span class="mail icon">Mail</span>
<span class="chat icon">Chat</span>
</body>
</html>

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值