前往小程序,Get更优阅读体验!
立即前往
首页
学习
活动
专区
工具
TVP
发布
社区首页 >专栏 >animation-name 属性——动画示例

animation-name 属性——动画示例

作者头像
Html5知典
发布2019-11-26 17:07:36
3610
发布2019-11-26 17:07:36
举报
文章被收录于专栏:Html5知典Html5知典

用途

animation-name 规定 @keyframes 动画的名称

语法

代码语言:javascript
复制
animation-name: none;
animation-name: identifier;

描述

none

特殊关键字,表示无关键帧。

identifier

动画名称。名称必须符合CSS语法中标识的定义。

例子

代码语言:javascript
复制
/* HTML */
<div class="stage"> 
    <figure class="ball"></figure> 
</div>
    
/* CSS */
@keyframes 'slide' { 
    from { 
        left: 0; 
        top: 0; } 
    50% { 
        left: 244px; 
        top: 100px; } 
    to { 
        left: 488px; 
        top: 0; } 
} 
.stage { 
    background: #ccc; 
    border-radius: 6px; 
    height: 150px; 
    position: relative; 
    min-width: 550px; 
} 
.stage .ball { 
    animation-name: slide; //与keyframes定义的名称保持一致
    animation-duration:2s; 
    animation-timing-function: ease-in-out; 
    animation-delay: 1.5s;//延迟1.5秒 
    animation-iteration-count: infinite; 
    animation-direction: alternate;//反向运行动画,每周期结束动画由尾到头运行。 } 
.ball { 
    background: red; 
    border-radius: 50%; 
    height: 40px; 
    position:
     absolute; 
     width: 40px; }

执行结果

本文参与 腾讯云自媒体同步曝光计划,分享自微信公众号。
原始发表:2018-11-27,如有侵权请联系 cloudcommunity@tencent.com 删除

本文分享自 Html5知典 微信公众号,前往查看

如有侵权,请联系 cloudcommunity@tencent.com 删除。

本文参与 腾讯云自媒体同步曝光计划  ,欢迎热爱写作的你一起参与!

评论
登录后参与评论
0 条评论
热度
最新
推荐阅读
领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档