英 [ˌænɪˈmeɪʃn]   美 [ˌænəˈmeʃən]  

n.生气,活泼;动画片制作,动画片摄制;[影视]动画片

复数: animations

css3 animation属性 语法

作用:animation 属性是一个简写属性,用于设置六个动画属性。

语法:animation: name duration timing-function delay iteration-count direction。

说明:animation-name    规定需要绑定到选择器的 keyframe 名称。。    animation-duration    规定完成动画所花费的时间,以秒或毫秒计。    animation-timing-function    规定动画的速度曲线。    animation-delay    规定在动画开始之前的延迟。    animation-iteration-count    规定动画应该播放的次数。    animation-direction    规定是否应该轮流反向播放动画。    

注释:请始终规定 animation-duration 属性,否则时长为 0,就不会播放动画了。

css3 animation属性是一个简写属性,通过设置六个动画属性来实现动画效果。这六个属性分别为动画名称、动画时间、速度曲线、动画延迟、播放次数及动画是否反向播放。

css3 animation属性 示例

<!DOCTYPE html>
<html>
<head>
<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 以及更早的版本不支持 animation 属性。</p>

<div></div>

</body>
</html>

运行实例 »

点击 "运行实例" 按钮查看在线实例

热门推荐