blob: 51c506a7e3168e87a14025772fac3c4d53e1850c (
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
|
---
title: window.cancelAnimationFrame()
slug: Web/API/Window/cancelAnimationFrame
tags:
- API
- DOM
- 레퍼런스
- 메소드
- 실험적
- 애니메이션
- 윈도우
translation_of: Web/API/Window/cancelAnimationFrame
---
<div>{{APIRef}}</div>
<p><code><strong>window.cancelAnimationFrame()</strong></code> 메소드는 이전에 {{domxref("window.requestAnimationFrame()")}} 을 호출하여 스케줄된 애니메이션 프레임 요청을 취소합니다.</p>
<h2 id="구문">구문</h2>
<pre class="syntaxbox">window.cancelAnimationFrame(<em>requestID</em>);
</pre>
<h3 id="Parameters">Parameters</h3>
<dl>
<dt><code>requestID</code></dt>
<dd>요청된 콜백 {{domxref("window.requestAnimationFrame()")}} 을 호출하여 반환된 ID 값.</dd>
</dl>
<h2 id="예시">예시</h2>
<pre class="brush: js">var requestAnimationFrame = window.requestAnimationFrame || window.mozRequestAnimationFrame ||
window.webkitRequestAnimationFrame || window.msRequestAnimationFrame;
var cancelAnimationFrame = window.cancelAnimationFrame || window.mozCancelAnimationFrame;
var start = window.mozAnimationStartTime; // Firefox 에서만 지원됨. 다른 브라우저에서는 Date.now() 같은 것을 사용할 수 있음.
var myReq;
function step(timestamp) {
var progress = timestamp - start;
d.style.left = Math.min(progress / 10, 200) + 'px';
if (progress < 2000) {
myReq = requestAnimationFrame(step);
}
}
myReq = requestAnimationFrame(step);
cancelAnimationFrame(myReq);
</pre>
<h2 id="브라우저_호환성">브라우저 호환성</h2>
<div>
<p>{{Compat("api.Window.cancelAnimationFrame")}}</p>
</div>
<h2 id="명세">명세</h2>
<ul>
<li>{{spec("https://www.w3.org/TR/html51/webappapis.html#animation-frames", "Timing control for script-based animations: cancelAnimationFrame", "WD")}}</li>
</ul>
<h2 id="함께_보기">함께 보기</h2>
<ul>
<li>{{domxref("window.mozAnimationStartTime")}}</li>
<li>{{domxref("window.requestAnimationFrame()")}}</li>
</ul>
|