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;
25 attribute AnimationEffect? effect;
26 // Bug 1676794. Drop BinaryName once we support ScrollTimeline interface.
27 [Func="Document::AreWebAnimationsTimelinesEnabled",
28 BinaryName="timelineFromJS"]
29 attribute AnimationTimeline? timeline;
31 [BinaryName="startTimeAsDouble"]
32 attribute double? startTime;
33 [SetterThrows, BinaryName="currentTimeAsDouble"]
34 attribute double? currentTime;
36 attribute double playbackRate;
37 [BinaryName="playStateFromJS"]
38 readonly attribute AnimationPlayState playState;
39 [BinaryName="pendingFromJS"]
40 readonly attribute boolean pending;
41 readonly attribute AnimationReplaceState replaceState;
43 readonly attribute Promise<Animation> ready;
45 readonly attribute Promise<Animation> finished;
46 attribute EventHandler onfinish;
47 attribute EventHandler oncancel;
48 attribute EventHandler onremove;
52 [Throws, BinaryName="playFromJS"]
54 [Throws, BinaryName="pauseFromJS"]
56 undefined updatePlaybackRate (double playbackRate);
61 undefined commitStyles();
64 // Non-standard extensions
65 partial interface Animation {
66 [ChromeOnly] readonly attribute boolean isRunningOnCompositor;