CSS3 animation(动画) 属性 | CSS3教程:CSS3动画

返回到:CSS3动画 | CSS3教程

语法

animation: name duration timing-function delay iteration-count direction fill-mode play-state;
说明
animation-name指定要绑定到选择器的关键帧的名称
animation-duration动画指定需要多少秒或毫秒完成
animation-timing-function设置动画将如何完成一个周期
animation-delay设置动画在启动前的延迟间隔。
animation-iteration-count定义动画的播放次数。
animation-direction指定是否应该轮流反向播放动画。
animation-fill-mode规定当动画不播放时(当动画完成时,或当动画有一个延迟未开始播放时),要应用到元素的样式。
animation-play-state指定动画是否正在运行或已暂停。
initial设置属性为其默认值。 
inherit从父元素继承属性。 

浏览器支持

表格中的数字表示支持该属性的第一个浏览器版本号。

紧跟在 -webkit-, -ms- 或 -moz- 前的数字为支持该前缀属性的第一个浏览器版本号。

属性谷歌IE火狐苹果opera
animation43.0
4.0 -webkit-
10.016.0
5.0 -moz-
9.0
4.0 -webkit-
30.0
15.0 -webkit-
12.0 -o-

标签定义及使用说明

默认值:none 0 ease 0 1 normal
继承:no
版本:CSS3
JavaScript 语法:object.style.animation=”mymove 5s infinite”

实例

使用简写属性把 animation 绑定到一个<div> 元素:

<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8"> 
<title>Web176教程网(web176.com)</title> 
<style> 
div
{
	width:100px;
	height:100px;
	background:red;
	position:relative;
	animation:mymove 5s infinite;
	-webkit-animation:mymove 5s infinite; /*Safari and Chrome*/
}

@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 及更早IE版本不支持 animation 属性。</p>

<div></div>

</body>
</html>

作者:terry,如若转载,请注明出处:https://www.web176.com/css3animate/5072.html

(0)
打赏 支付宝 支付宝 微信 微信
terryterry
上一篇 2022年1月10日 下午3:03
下一篇 2022年1月10日 下午3:13

相关推荐

发表回复

您的电子邮箱地址不会被公开。 必填项已用*标注