1 /* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 /* This Source Code Form is subject to the terms of the Mozilla Public
3 * License, v. 2.0. If a copy of the MPL was not distributed with this file,
4 * You can obtain one at http://mozilla.org/MPL/2.0/.
6 * The origin of this IDL file is
7 * https://drafts.csswg.org/web-animations/#animation
9 * Copyright © 2015 W3C® (MIT, ERCIM, Keio), All Rights Reserved. W3C
10 * liability, trademark and document use rules apply.
13 enum AnimationPlayState { "idle", "running", "paused", "finished" };
15 enum AnimationReplaceState { "active", "removed", "persisted" };
18 interface Animation : EventTarget {
20 constructor(optional AnimationEffect? effect = null,
21 optional AnimationTimeline? timeline);
23 attribute DOMString id;
24 [Func="Document::IsWebAnimationsEnabled", Pure]
25 attribute AnimationEffect? effect;
26 [Func="Document::AreWebAnimationsTimelinesEnabled"]
27 attribute AnimationTimeline? timeline;
28 [BinaryName="startTimeAsDouble"]
29 attribute double? startTime;
30 [SetterThrows, BinaryName="currentTimeAsDouble"]
31 attribute double? currentTime;
33 attribute double playbackRate;
34 [BinaryName="playStateFromJS"]
35 readonly attribute AnimationPlayState playState;
36 [BinaryName="pendingFromJS"]
37 readonly attribute boolean pending;
38 [Pref="dom.animations-api.autoremove.enabled"]
39 readonly attribute AnimationReplaceState replaceState;
40 [Func="Document::IsWebAnimationsEnabled", Throws]
41 readonly attribute Promise<Animation> ready;
42 [Func="Document::IsWebAnimationsEnabled", Throws]
43 readonly attribute Promise<Animation> finished;
44 attribute EventHandler onfinish;
45 attribute EventHandler oncancel;
46 [Pref="dom.animations-api.autoremove.enabled"]
47 attribute EventHandler onremove;
51 [Throws, BinaryName="playFromJS"]
53 [Throws, BinaryName="pauseFromJS"]
55 void updatePlaybackRate (double playbackRate);
58 [Pref="dom.animations-api.autoremove.enabled"]
60 [Pref="dom.animations-api.autoremove.enabled", Throws]
64 // Non-standard extensions
65 partial interface Animation {
66 [ChromeOnly] readonly attribute boolean isRunningOnCompositor;