aboutsummaryrefslogtreecommitdiff
path: root/files/zh-cn/web/css/animation-timing-function/index.html
blob: c4bc03f81c3902437b2adf60b28a2748caac73c3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
---
title: animation-timing-function
slug: Web/CSS/animation-timing-function
tags:
  - CSS
  - CSS Animations
  - CSS Property
  - Experimental
  - Reference
translation_of: Web/CSS/animation-timing-function
---
<p>{{CSSRef}}</p>

<h2 id="概述">概述</h2>

<p><a href="/en-US/docs/CSS" title="CSS">CSS</a> <code>animation-timing-function属性定义CSS动画在每一动画周期中执行的节奏。</code>可能值为一或多个 {{cssxref("&lt;timing-function&gt;")}}</p>

<p>对于关键帧动画来说,timing function作用于一个关键帧周期而非整个动画周期,即从关键帧开始开始,到关键帧结束结束。</p>

<p>定义于一个关键帧区块的缓动函数(animation timing function)应用到改关键帧;另外,若该关键帧没有定义缓动函数,则使用定义于整个动画的缓动函数。</p>

<pre class="brush: css"><code>/* Keyword values */
animation-timing-function: ease;
animation-timing-function: ease-in;
animation-timing-function: ease-out;
animation-timing-function: ease-in-out;
animation-timing-function: linear;
animation-timing-function: step-start;
animation-timing-function: step-end;</code>

/* Function values */
animation-timing-function: cubic-bezier(0.1, 0.7, 1.0, 0.1);
animation-timing-function: steps(4, end);
animation-timing-function: frames(10);

/* Multiple animations */
animation-timing-function: ease, step-start, cubic-bezier(0.1, 0.7, 1.0, 0.1);

/* Global values */
animation-timing-function: inherit;
animation-timing-function: initial;
animation-timing-function: unset;</pre>

<p>通常用{{cssxref("animation")}}简写定义整个动画属性更为方便。</p>

<p>{{cssinfo}}</p>

<h2 id="语法">语法</h2>

<h3 id="值"></h3>

<dl>
 <dt><code>&lt;timingfunction&gt;</code></dt>
 <dd>每个 {{cssxref("&lt;timing-function&gt;")}}代表了应用于动画的timing function,定义于{{cssxref("animation-property")}}.</dd>
</dl>

<h3 id="正式语法">正式语法</h3>

<pre class="syntaxbox">{{csssyntax("animation-timing-function")}}
</pre>

<h2 id="示例">示例</h2>

<p>参见 <a href="/en-US/docs/CSS/CSS_animations" title="en-US/docs/CSS/CSS_animations">CSS animations</a></p>

<h2 id="Specifications" name="Specifications">规范</h2>

<table class="standard-table">
 <thead>
  <tr>
   <th scope="col">规范</th>
   <th scope="col">状态</th>
   <th scope="col">备注</th>
  </tr>
 </thead>
 <tbody>
  <tr>
   <td>{{SpecName('CSS3 Animations', '#animation-timing-function', 'animation-timing-function')}}</td>
   <td>{{Spec2('CSS3 Animations')}}</td>
   <td></td>
  </tr>
 </tbody>
</table>

<h2 id="Browser_Compatibility" name="Browser_Compatibility">浏览器兼容性</h2>

<p>{{Compat("css.properties.animation-timing-function")}}</p>

<h2 id="参见">参见</h2>

<ul>
 <li><a href="/en-US/docs/Web/Guide/CSS/Using_CSS_transitions" title="CSS developer guide about CSS animations">Using CSS animations</a></li>
 <li>{{domxref("AnimationEvent", "AnimationEvent")}}</li>
</ul>