aboutsummaryrefslogtreecommitdiff
path: root/files/de/web/api/window/cancelanimationframe/index.html
blob: 7d38ab5be4a9bc30321f02e10b604dc4ea9582f5 (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
  - Animation
  - DOM
  - Experimentell
  - Méthode
translation_of: Web/API/Window/cancelAnimationFrame
---
<div>{{APIRef}}{{SeeCompatTable}}</div>

<h2 id="Summary" name="Summary">Zusammenfassung</h2>

<p>Stopt eine vorher durch {{domxref("window.requestAnimationFrame()")}} geplante Animation.</p>

<h2 id="Syntax" name="Syntax">Syntax</h2>

<pre class="syntaxbox">window.cancelAnimationFrame(<em>requestID</em>);
</pre>

<h3 id="Parameters" name="Parameters">Parameter</h3>

<dl>
 <dt><code>requestID</code></dt>
 <dd>Der ID Wert der beim Aufruf von {{domxref("window.requestAnimationFrame()")}} vorher zurückgegeben wurde.</dd>
</dl>

<h2 id="Examples" name="Examples">Beispiel</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;  // Nur unterstützt in FF. Andere Browsers können zB Date.now() benutzen.

var myReq;

function step(timestamp) {
  var progress = timestamp - start;
  d.style.left = Math.min(progress/10, 200) + "px";
  if (progress &lt; 2000) {
    myReq = requestAnimationFrame(step);
  }
}
myReq = requestAnimationFrame(step);

window.cancelAnimationFrame(myReq);
</pre>

<h2 id="Browser_compatibility" name="Browser_compatibility">Browserkompatibilität</h2>

<div class="hidden">
<p>The compatibility table on this page is generated from structured data. If you'd like to contribute to the data, please check out <a href="https://github.com/mdn/browser-compat-data">https://github.com/mdn/browser-compat-data</a> and send us a pull request.</p>
</div>

<p>{{Compat("api.Window.cancelAnimationFrame")}}</p>

<h2 id="Specification" name="Specification">Spezifikation</h2>

<ul>
 <li>{{spec("http://www.w3.org/TR/animation-timing/#cancelAnimationFrame", "Timing control for script-based animations: cancelAnimationFrame", "WD")}}</li>
</ul>

<h2 id="Siehe_auch">Siehe auch</h2>

<ul>
 <li>{{domxref("window.mozAnimationStartTime")}}</li>
 <li>{{domxref("window.requestAnimationFrame()")}}</li>
</ul>