aboutsummaryrefslogtreecommitdiff
path: root/files/es/web/api/animation/finished/index.html
blob: 60e23d235b53ef87b1b2d125308297d409df22fb (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
---
title: Animation.finished
slug: Web/API/Animation/finished
tags:
  - API
  - Animacion
  - Animaciones Web
  - Experimental
  - Reference
translation_of: Web/API/Animation/finished
original_slug: Web/API/Animation/terminado
---
<p>{{ SeeCompatTable() }}{{ APIRef("Web Animations") }}</p>

<p>La propiedad de solo-lectura de <code><strong>Animation</strong></code><strong><code>.finished</code></strong> de la  <a href="https://developer.mozilla.org/en-US/docs/Web/API/Web_Animations_API">Web Animations API</a> devuelve un {{jsxref("Promise")}} que se resuelve una vez que la animación a terminado de reproducirse.</p>

<div class="note">
<p>Una vez que la reproducción de la animación abandona el estado  <code>finished</code>  ( es decir, la reproducción se está ejecutando otra vez ), Un nuevo <code>Promise</code> es creado para esta propiedad. El nuevo <code>Promise</code> será resuelto cuando se haya completado la actual secuencia de la animación.</p>
</div>

<h2 id="Sintaxis">Sintaxis</h2>

<pre class="syntaxbox">var <em>animationsPromise</em> = <em>Animation.</em>finished;
</pre>

<h3 id="Valor">Valor</h3>

<p>Un objeto {{jsxref("Promise")}} que se resuelve cuando haya finalizado la reproducción de la animación.</p>

<h2 id="Ejemplos">Ejemplos</h2>

<p>El siguiente código espera a que todas las animaciones que se ejecutan en el elemento <code>elem</code> hayan terminado, después elimina el elemento del arbol del DOM:</p>

<pre class="brush: js">Promise.all(
  elem.getAnimations().map(
    function(animation) {
      return animation.finished
    }
  )
).then(
  function() {
    return elem.remove();
  }
);</pre>

<h2 id="Especificaciones">Especificaciones</h2>

<table class="standard-table">
 <tbody>
  <tr>
   <th scope="col">Specification</th>
   <th scope="col">Status</th>
   <th scope="col">Comment</th>
  </tr>
  <tr>
   <td>{{SpecName('Web Animations', '#dom-animation-finished', 'Animation.finished' )}}</td>
   <td>{{Spec2('Web Animations')}}</td>
   <td>Editor's draft.</td>
  </tr>
 </tbody>
</table>

<h2 id="Compatibilidad_del_navegador">Compatibilidad del navegador</h2>

{{Compat("api.Animation.finished")}}

<h2 id="Ver_también" style="line-height: 30px; font-size: 2.14285714285714rem;">Ver también</h2>

<ul>
 <li>{{domxref("KeyframeEffect")}}</li>
 <li><a href="/en-US/docs/Web/API/Web_Animations_API">Web Animations API</a></li>
 <li>{{domxref("Animation")}}</li>
</ul>