非常教程

CSS 参考手册教程

CSS3 animation-timing-function 属性

CSS3 animation-timing-function 属性

CSS3 animation-timing-function 属性


实例

从开始到结束以相同的速度播放动画:

animation-timing-function:linear; -webkit-animation-timing-function:linear; /* Safari and Chrome */

尝试一下 »
在此页底部有更多的例子。

浏览器支持

属性
animation-timing-function 43.0
4.0 -webkit-
10.0 16.0
5.0 -moz-
9.0
4.0 -webkit-
30.0
15.0 -webkit-
12.0 -o-

标签定义及使用说明

animation-timing-function指定动画将如何完成一个周期。

速度曲线定义动画从一套 CSS 样式变为另一套所用的时间。

速度曲线用于使变化更为平滑。

默认值: ease
继承: no
版本: CSS3
JavaScript 语法: object object.style.animationTimingFunction="linear"


语法

animation-timing-function: value;

animation-timing-function使用的数学函数,称为三次贝塞尔曲线,速度曲线。使用此函数,您可以使用您自己的值,或使用预先定义的值之一:

描述 测试
linear 动画从头到尾的速度是相同的。 测试
ease 默认。动画以低速开始,然后加快,在结束前变慢。 测试
ease-in 动画以低速开始。 测试
ease-out 动画以低速结束。 测试
ease-in-out 动画以低速开始和结束。 测试
cubic-bezier(n,n,n,n) 在 cubic-bezier 函数中自己的值。可能的值是从 0 到 1 的数值。

提示: 请试着在下面的"尝试一下"功能中使用不同的值。


CSS3 animation-timing-function 属性

在线实例


实例

为了更好地理解不同的定时函数值,这里提供了设置五个不同值的五个不同的 div 元素:

/* Chrome, Safari 和 Opera */ #div1 {-webkit-animation-timing-function: linear;} #div2 {-webkit-animation-timing-function: ease;} #div3 {-webkit-animation-timing-function: ease-in;} #div4 {-webkit-animation-timing-function: ease-out;} #div5 {-webkit-animation-timing-function: ease-in-out;} /* 标准语法 */ #div1 {animation-timing-function: linear;} #div2 {animation-timing-function: ease;} #div3 {animation-timing-function: ease-in;} #div4 {animation-timing-function: ease-out;} #div5 {animation-timing-function: ease-in-out;}

尝试一下 »

实例

与上例相同,但是通过 cubic-bezier 函数来定义速度曲线:

#div1 {animation-timing-function:cubic-bezier(0,0,0.25,1);} #div2 {animation-timing-function:cubic-bezier(0.25,0.1,0.25,1);} #div3 {animation-timing-function:cubic-bezier(0.42,0,1,1);} #div4 {animation-timing-function:cubic-bezier(0,0,0.58,1);} #div5 {animation-timing-function:cubic-bezier(0.42,0,0.58,1);} /* Safari and Chrome: */ #div1 {-webkit-animation-timing-function:cubic-bezier(0,0,0.25,1);} #div2 {-webkit-animation-timing-function:cubic-bezier(0.25,0.1,0.25,1);} #div3 {-webkit-animation-timing-function:cubic-bezier(0.42,0,1,1);} #div4 {-webkit-animation-timing-function:cubic-bezier(0,0,0.58,1);} #div5 {-webkit-animation-timing-function:cubic-bezier(0.42,0,0.58,1);}

尝试一下 »


相关文章

CSS3 教程: CSS3 动画

CSS3 animation-timing-function 属性
CSS 参考手册

CSS 参考手册提供了完整的 CSS 属性列表,每个属性都配有语法说明及实例演示,另外还讲解了 CSS 选择器、颜色值及浏览器支持等相关内容。

CSS 参考手册目录

1.CSS 听觉参考手册
2.CSS 选择器
3.CSS 参考手册
4.CSS3 animation-name 属性
5.CSS3 animation 属性
6.CSS3 @keyframes 规则
7.CSS 浏览器支持
8.CSS 颜色十六进制值
9.CSS 颜色名称
10.CSS 合法颜色值
11.CSS 颜色
12.CSS 单位
13.CSS Web安全字体
14.CSS3 animation-timing-function 属性
15.CSS3 animation-duration 属性
16.CSS background-color 属性
17.CSS background-attachment 属性
18.CSS background 属性
19.CSS3 backface-visibility 属性
20.CSS3 appearance 属性
21.CSS3 animation-play-state 属性
22.CSS3 animation-iteration-count 属性
23.CSS3 animation-delay 属性
24.CSS background-repeat 属性
25.CSS background-position 属性
26.CSS background-image 属性
27.CSS border 属性
28.CSS3 background-size 属性
29.CSS3 background-origin 属性
30.CSS3 background-clip 属性
31.CSS border-bottom-style 属性
32.CSS border-bottom-color 属性
33.CSS border-bottom 属性
34.CSS border-right-style 属性
35.CSS border-right 属性
36.CSS border-left-width 属性
37.CSS border-left-style 属性
38.CSS border-left-color 属性
39.CSS Border-left 属性
40.CSS border-color 属性
41.CSS border-collapse 属性
42.CSS border-bottom-width 属性
43.CSS3 border-bottom-left-radius 属性
44.CSS border-width 属性
45.CSS border-top-color 属性
46.CSS border-top-style 属性
47.CSS border-top-width 属性
48.CSS border-top 属性
49.CSS border-style 属性
50.CSS border-spacing 属性
51.CSS border-right-width 属性
52.CSS border-right-color 属性
53.CSS3 border-image-width 属性
54.CSS3 border-radius 属性
55.CSS3 border-top-left-radius 属性
56.CSS3 border-top-right-radius 属性
57.CSS3 border-image-source 属性
58.CSS3 border-image-slice 属性
59.CSS3 border-image-repeat 属性
60.CSS3 border-image-outset 属性
61.CSS3 border-image 属性
62.CSS3 border-bottom-right-radius 属性
63.CSS3 box-sizing 属性
64.CSS3 box-pack 属性
65.CSS3 box-orient 属性
66.CSS3 box-ordinal-group 属性
67.CSS3 box-lines 属性
68.CSS3 box-flex-group 属性
69.CSS3 box-flex 属性
70.CSS3 box-direction 属性
71.CSS3 box-align 属性
72.CSS bottom 属性
73.CSS3 column-rule-color 属性
74.CSS3 column-rule 属性
75.CSS3 column-gap 属性
76.CSS3 column-fill 属性
77.CSS3 column-count 属性
78.CSS color 属性
79.CSS clip 属性
80.CSS clear 属性
81.CSS caption-side 属性
82.CSS3 box-shadow 属性
83.CSS :after 选择器
84.CSS :before 选择器
85.CSS content 属性
86.CSS3 columns 属性
87.CSS3 column-width 属性
88.CSS3 column-span 属性
89.CSS3 column-rule-width 属性
90.CSS3 column-rule-style 属性
91.CSS font 属性
92.CSS float 属性
93.CSS Empty-cells 属性
94.CSS display 属性
95.CSS direction 属性
96.CSS cursor 属性
97.CSS counter-reset 属性
98.CSS counter-increment 属性
99.CSS3 grid-columns 属性
100.CSS3 font-stretch 属性