aboutsummaryrefslogtreecommitdiff
path: root/files/zh-cn/web/css/animation-direction/index.html
blob: 777678b06a9609bb88b298be42fdd9ddde61a900 (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
---
title: animation-direction
slug: Web/CSS/animation-direction
tags:
  - CSS
  - CSS Animations
  - CSS Property
  - Experimental
  - Reference
translation_of: Web/CSS/animation-direction
---
<div>{{CSSRef}}</div>

<div>{{SeeCompatTable}}</div>

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

<p><code>animation-direction</code> CSS 属性指示动画是否反向播放,它通常在简写属性{{cssxref("animation")}}中设定</p>

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

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

<pre class="twopartsyntaxbox"><a href="/en-US/docs/CSS/Value_definition_syntax" title="CSS/Value_definition_syntax">Formal syntax</a>:  {{csssyntax("animation-direction")}}
</pre>

<pre>animation-direction: normal
animation-direction: reverse
animation-direction: alternate
animation-direction: alternate-reverse
animation-direction: normal, reverse
animation-direction: alternate, reverse, normal
</pre>

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

<dl>
 <dt><code>normal</code></dt>
 <dd>每个循环内动画向前循环,换言之,每个动画循环结束,动画重置到起点重新开始,这是默认属性。</dd>
 <dt><code>alternate</code></dt>
  <dd>动画交替反向运行,反向运行时,动画按步后退,同时,带时间功能的函数也反向,比如,<code>ease-in</code> 在反向时成为 <code>ease-out</code>。计数取决于开始时是奇数迭代还是偶数迭代</dd>
 <dt><code>reverse</code></dt>
 <dd>反向运行动画,每周期结束动画由尾到头运行。</dd>
 <dt><code>alternate-reverse</code></dt>
 <dd>反向交替, 反向开始交替</dd>
 <dd>动画第一次运行时是反向的,然后下一次是正向,后面依次循环。决定奇数次或偶数次的计数从1开始。</dd>
</dl>

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

<p>See <a href="/en-US/docs/CSS/CSS_animations" title="CSS/CSS_animations">CSS animations</a> for examples.</p>

<h2 id="Specifications">Specifications</h2>

<table class="standard-table">
 <thead>
  <tr>
   <th scope="col">Specification</th>
   <th scope="col">Status</th>
   <th scope="col">Comment</th>
  </tr>
 </thead>
 <tbody>
  <tr>
   <td>{{SpecName('CSS3 Animations', '#animation-direction', 'animation-direction')}}</td>
   <td>{{Spec2('CSS3 Animations')}}</td>
   <td>For the two new values, see the <a href="http://lists.w3.org/Archives/Public/www-style/2011May/0090.html">W3C discussion</a>.</td>
  </tr>
 </tbody>
</table>

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



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

<h2 id="更多">更多</h2>

<ul>
 <li><a href="/en-US/docs/CSS/Tutorials/Using_CSS_animations" title="Tutorial about CSS animations">Using CSS animations</a></li>
 <li>{{domxref("AnimationEvent", "AnimationEvent")}}</li>
</ul>