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
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
|
---
title: transition-timing-function
slug: Web/CSS/transition-timing-function
tags:
- CSS
- CSS Reference
- 'CSS:Mozilla Extensions'
- Fixit
- NeedsNewCompatTable
translation_of: Web/CSS/transition-timing-function
---
<div>{{CSSRef}}</div>
<p>CSS の <strong><code>transition-timing-function</code></strong> プロパティは、<a href="/ja/docs/Web/CSS/CSS_Transitions/Using_CSS_transitions">トランジション効果</a>の作用を受ける CSS プロパティにおいて、中間状態の値を算出する方法を設定するために使用されます。</p>
<div>{{EmbedInteractiveExample("pages/css/transition-timing-function.html")}}</div>
<p class="hidden">このデモのソースファイルは GitHub リポジトリに格納されています。デモプロジェクトに協力したい場合は、 <a href="https://github.com/mdn/interactive-examples">https://github.com/mdn/interactive-examples</a> をクローンしてプルリクエストを送信してください。</p>
<p>このプロパティは、簡単に言えば加速曲線を定義するもので、それによりトランジション実行中の値の変更速度を操作することができます。</p>
<p>この加速曲線は、トランジションが行われるプロパティごとに 1 つの {{cssxref("<timing-function>")}} を用いて定義されます。</p>
<p>複数のタイミング関数を指定することができます。それぞれのタイミング関数は、 {{ cssxref("transition-property") }} で指定されたように対応するプロパティに適用され、 <code>transition-property</code> のリストとして振るまいます。指定されたタイミング関数が <code>transition-property</code> のリストより少ない場合は、ユーザーエージェントはリスト内の値をそれぞれのトランジションプロパティのうちの値になるまで繰り返してどの値が使用されるかを計算します。関数の数が多い場合は、リストを適切な長さに切り詰めます。どちらの場合も、 CSS の宣言として妥当です。</p>
<h2 id="Syntax" name="Syntax">構文</h2>
<pre class="syntaxbox">/* キーワード値 */
transition-timing-function: ease;
transition-timing-function: ease-in;
transition-timing-function: ease-out;
transition-timing-function: ease-in-out;
transition-timing-function: linear;
transition-timing-function: step-start;
transition-timing-function: step-end;
/* 関数値 */
transition-timing-function: steps(4, jump-end);
transition-timing-function: cubic-bezier(0.1, 0.7, 1.0, 0.1);
/* 段階式の関数のキーワード */
transition-timing-function: steps(4, jump-start);
transition-timing-function: steps(10, jump-end);
transition-timing-function: steps(20, jump-none);
transition-timing-function: steps(5, jump-both);
transition-timing-function: steps(6, start);
transition-timing-function: steps(8, end);
/* 複数のタイミング関数 */
transition-timing-function: ease, step-start, cubic-bezier(0.1, 0.7, 1.0, 0.1);
/* グローバル値 */
transition-timing-function: inherit;
transition-timing-function: initial;
transition-timing-function: unset;</pre>
<h3 id="Values" name="Values">値</h3>
<dl>
<dt><code><timing-function></code></dt>
<dd>各々の {{cssxref("<timing-function>")}} は {{ cssxref("transition-property") }} で指定された、トランジションを行うプロパティに対応するタイミング関数を表します。
<p>非段階のキーワード値 (ease, linear, ease-in-out, など) はそれぞれ4つの固定点による二次元ベジェ曲線を表しており、 cubic-bezier() 関数の値は定義済みの値以外を使用することができます。 The step timing functions divides the input time into a specified number of intervals that are equal in length. It is defined by a number of steps and a step position.</p>
<dl>
<dt><code>ease</code></dt>
<dd>Equal to <code>cubic-bezier(0.25, 0.1, 0.25, 1.0)</code>, the default value, increases in velocity towards the middle of the transition, slowing back down at the end.</dd>
<dt><code>linear</code></dt>
<dd>Equal to <code>cubic-bezier(0.0, 0.0, 1.0, 1.0)</code>, transitions at an even speed.</dd>
<dt><code>ease-in</code></dt>
<dd>Equal to <code>cubic-bezier(0.42, 0, 1.0, 1.0)</code>, starts off slowly, with the transition speed increasing until complete.</dd>
<dt><code>ease-out</code></dt>
<dd>Equal to <code>cubic-bezier(0, 0, 0.58, 1.0)</code>, starts transitioning quickly, slowing down the transition continues. •</dd>
<dt><code>ease-in-out</code></dt>
<dd>Equal to <code>cubic-bezier(0.42, 0, 0.58, 1.0)</code>, starts transitioning slowly, speeds up, and then slows down again.</dd>
<dt><code>cubic-bezier(p1, p2, p3, p4)</code></dt>
<dd>An author defined cubic-Bezier curve, where the p1 and p3 values must be in the range of 0 to 1.</dd>
<dt><code>steps( n, <jumpterm>)</code></dt>
<dd>Displays the transition along <em>n stops along the transition, displaying each stop for </em>equal lengths of time. For example, if <em>n</em> is 5, there are 5 steps. Whether the transition holds temporarily at 0%, 20%, 40%, 60% and 80%, on the 20%, 40%, 60%, 80% and 100%, or makes 5 stops between the 0% and 100% along the transition, or makes 5 stops including the 0% and 100% marks (on the 0%, 25%, 50%, 75%, and 100%) depends on which of the following jump terms is used:
<dl>
<dt><code>jump-start</code></dt>
<dd>Denotes a left-continuous function, so that the first jump happens when the transition begins;</dd>
<dt><code>jump-end</code></dt>
<dd>Denotes a right-continuous function, so that the last jump happens when the animation ends;</dd>
<dt><code>jump-none</code></dt>
<dd>There is no jump on either end. Instead, holding at both the 0% mark and the 100% mark, each for 1/n of the duration</dd>
<dt><code>jump-both</code></dt>
<dd>Includes pauses at both the 0% and 100% marks, effectively adding a step during the transition time.</dd>
<dt><code>start</code></dt>
<dd>Same as <code>jump-start.</code></dd>
<dt><code>end</code></dt>
<dd>Same as <code>jump-end.</code></dd>
</dl>
</dd>
<dt><code>step-start</code></dt>
<dd>Equal to <code>steps(1, jump-start)</code></dd>
<dt><code>step-end</code></dt>
<dd>Equal to <code>steps(1, jump-end)</code></dd>
</dl>
</dd>
</dl>
<h3 id="Formal_syntax" name="Formal_syntax">形式文法</h3>
{{csssyntax}}
<h2 id="Examples" name="Examples">例</h2>
<div>
<h3 id="Cubic-Bezier_examples">Cubic-Bezier examples</h3>
<div class="hidden">
<pre class="brush:html"><div class="parent">
<div class="ease">ease</div>
<div class="easein">ease-in</div>
<div class="easeout">ease-out</div>
<div class="easeinout">ease-in-out</div>
<div class="linear">linear</div>
<div class="cb">cubic-bezier(0.2,-2,0.8,2)</div>
</div></pre>
<pre class="brush:css;">.parent {}
.parent > div[class] {
width: 12em;
min-width: 12em;
margin-bottom: 4px;
background-color: black;
border: 1px solid red;
color: white;
transition-property: all;
transition-duration: 7s;
}
.parent > div.box1{
width: 90vw;
min-width: 24em;
background-color: magenta;
color: yellow;
border: 1px solid orange;
transition-property: all;
transition-duration: 2s;
}
</pre>
<pre class="brush:js">function updateTransition() {
var els = document.querySelectorAll(".parent > div[class]");
for(var c = els.length, i = 0; i < c; i++) {
els[i].classList.toggle("box1");
}
}
var intervalID = window.setInterval(updateTransition, 10000);
</pre>
</div>
<pre class="brush: css">.ease {
transition-timing-function: ease;
}
.easein {
transition-timing-function: ease-in;
}
.easeout {
transition-timing-function: ease-out;
}
.easeinout {
transition-timing-function: ease-in-out;
}
.linear {
transition-timing-function: linear;
}
.cb {
transition-timing-function: cubic-bezier(0.2,-2,0.8,2);
}</pre>
<div>{{EmbedLiveSample("Cubic-Bezier_examples")}}</div>
</div>
<div>
<h3 id="Step_examples">Step examples</h3>
<div class="hidden">
<pre class="brush:html"><div class="parent">
<div class="jump-start">jump-start</div>
<div class="jump-end">jump-end</div>
<div class="jump-both">jump-both</div>
<div class="jump-none">jump-none</div>
<div class="step-start">step-start</div>
<div class="step-end">step-end</div>
</div></pre>
<pre class="brush:css;">.parent {}
.parent > div[class] {
width: 12em;
min-width: 12em;
margin-bottom: 4px;
background-color: black;
border: 1px solid red;
color: white;
transition-property: all;
transition-duration:7s;
}
.parent > div.box1{
width: 90vw;
min-width: 24em;
background-color: magenta;
color: yellow;
border: 1px solid orange;
transition-property: all;
transition-duration:2s;
}
</pre>
<pre class="brush:js">function updateTransition() {
var els = document.querySelectorAll(".parent > div[class]");
for(var c = els.length, i = 0; i < c; i++) {
els[i].classList.toggle("box1");
}
}
var intervalID = window.setInterval(updateTransition, 10000);
</pre>
</div>
<pre class="brush: css">.jump-start {
transition-timing-function: steps(5, jump-start);
}
.jump-end {
transition-timing-function: steps(5, jump-end);
}
.jump-none {
transition-timing-function: steps(5, jump-none);
}
.jump-both {
transition-timing-function: steps(5, jump-both);
}
.step-start {
transition-timing-function: step-start;
}
.step-end {
transition-timing-function: step-end;
}</pre>
<div>{{EmbedLiveSample("Step_examples")}}</div>
</div>
<h2 id="Accessibility_concerns" name="Accessibility_concerns">アクセシビリティの考慮事項</h2>
<p>Some animations can be helpful such as to guide users to understand what actions are expected, to show relationships within the user interface, and to inform users as to what actions have occurred. Animations can help reduce cognitive load, prevent change blindness, and establish better recall in spatial relationships. However, some animations can be problematic for people with cognitive concerns such as Attention Deficit Hyperactivity Disorder (ADHD) and certain kinds of motion can be a trigger for Vestibular disorders, epilepsy, and migraine and Scotopic sensitivity.</p>
<p>Consider providing a mechanism for pausing or disabling animation, as well as using the <a href="/en-US/docs/Web/CSS/@media/prefers-reduced-motion">Reduced Motion Media Query</a> to create a complimentary experience for users who have expressed a preference for no animated experiences.</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 Transitions', '#transition-timing-function-property', 'transition-timing-function') }}</td>
<td>{{ Spec2('CSS3 Transitions') }}</td>
<td>初回定義</td>
</tr>
</tbody>
</table>
<p>{{cssinfo}}</p>
<h2 id="Browser_compatibility" name="Browser_compatibility">ブラウザーの互換性</h2>
<div class="hidden">このページの互換性一覧表は構造化データから生成されています。データに協力していただけるのであれば、 <a class="external" href="https://github.com/mdn/browser-compat-data">https://github.com/mdn/browser-compat-data</a> をチェックアウトしてプルリクエストを送信してください。</div>
<p>{{Compat("css.properties.transition-timing-function")}}</p>
<h2 id="See_also" name="See_also">関連情報</h2>
<ul>
<li><a href="/ja/docs/Web/CSS/CSS_Transitions/Using_CSS_transitions" title="CSS transition の使用">CSS transition の使用</a></li>
<li>{{cssxref('transition')}}</li>
<li>{{cssxref('transition-property')}}</li>
<li>{{cssxref('transition-duration')}}</li>
<li>{{cssxref('transition-delay')}}</li>
<li>{{domxref("TransitionEvent")}}</li>
</ul>
|