• 技术文章 >web前端 >前端问答

    css animation-play-state属性怎么用

    藏色散人藏色散人2019-05-29 09:26:46原创1674
    css animation-play-state属性规定动画正在运行还是暂停。animation-play-state: paused;表示动画已暂停,animation-play-state: running;表示动画正在播放。

    css animation-play-state属性怎么用?

    作用:animation-play-state 属性规定动画正在运行还是暂停。

    语法:

    animation-play-state: paused|running;

    说明:paused 规定动画已暂停。running 规定动画正在播放。

    注释:您可以在 JavaScript 中使用该属性,这样就能在播放过程中暂停动画。

    css animation-play-state属性使用示例

    <!DOCTYPE html>
    <html>
    <head>
    <style> 
    div
    {
    width:100px;
    height:100px;
    background:red;
    position:relative;
    animation:mymove 5s;
    animation-play-state:paused;
    /* Safari and Chrome */
    -webkit-animation:mymove 5s;
    -webkit-animation-play-state:paused;
    }
    @keyframes mymove
    {
    from {left:0px;}
    to {left:200px;}
    }
    @-webkit-keyframes mymove /* Safari and Chrome */
    {
    from {left:0px;}
    to {left:200px;}
    }
    </style>
    </head>
    <body>
    <p><strong>注释:</strong>Internet Explorer 9 以及更早的版本不支持 animation-play-state 属性。</p>
    <div></div>
    </body>
    </html>

    效果:

    7eb21e6949d7a97db63063c4f528159.png

    以上就是css animation-play-state属性怎么用的详细内容,更多请关注php中文网其它相关文章!

    声明:本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系admin@php.cn核实处理。
    上一篇:css animation-iteration-count属性怎么用 下一篇:css animation-timing-function属性怎么用
    VIP课程(WEB全栈开发)

    相关文章推荐

    • 【活动】充值PHP中文网VIP即送云服务器• css animation-duration属性怎么用• css border-style属性怎么用• css animation-iteration-count属性怎么用• css background-repeat属性怎么用
    1/1

    PHP中文网