• css3动画怎么停止?


    动画是使元素从一种样式逐渐变化为另一种样式的效果。您可以改变任意多的样式任意多的次数。请用百分比来规定变化发生的时间,或用关键词 "from" 和 "to",等同于 0% 和 100%。

    css3的animation直接提供一个animation-play-state的样式来控制动画的暂停处理。增加一个控制暂停样式,写动画样式的时候特别注意下不同浏览器的兼容性,加上对应的前缀。

    豌豆资源搜索网站https://55wd.com 广州vi设计公司http://www.maiqicn.com

    示例:

    css3使用animation--play-state属性设置动画停止运行。

    <html><!DOCTYPE html>
    <html>
    <head>
    <meta charset="utf-8"> 
    <title>菜鸟教程(runoob.com)</title> 
    <style> 
    div
    {
    	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> animation-play-state属性不兼容 Internet Explorer 9以及更早版本的浏览器.</p>
    
    <div></div>
    
    </body>
    </html>

    animation--play-state属性指定动画是否正在运行或已暂停。

    注意:在JavaScript中使用此属性在一个周期中暂停动画。

    animation-play-state: paused|running;
    • paused 指定暂停动画

    • running 指定正在运行的动画

  • 相关阅读:
    asp .net 页面回车触发button 按钮事件
    Asp.netPost&Get转
    2012.8.16近期总结,1模态窗口回传重新被弹出2,清空缓存 3,
    面试感言
    2012.6.27近期总结,1.sql字符串转换(cast,CONVERT )调用wcf服务,关闭模态窗口刷新付页面
    self
    空指针
    枚举和结构体
    typedef
    指针
  • 原文地址:https://www.cnblogs.com/qianxiaox/p/13740339.html
Copyright © 2020-2023  润新知