OLD | NEW |
---|---|
(Empty) | |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | |
2 // Use of this source code is governed by a BSD-style license that can be | |
3 // found in the LICENSE file. | |
4 | |
5 /** | |
6 * @fileoverview Minimal Closure externs for Web Animations. | |
7 * "Minimal" because the web-animations spec is in flux, Chromium's support is | |
8 * changing, and the intended consumer (MD Settings) is actually using the | |
9 * web-animations-js polyfill for the time being. | |
10 * @see https://w3c.github.io/web-animations/#programming-interface | |
11 */ | |
12 | |
13 /** | |
14 * @enum {number} | |
15 * @see https://w3c.github.io/web-animations/#enumdef-fillmode | |
16 */ | |
17 var FillMode = { | |
18 'none': 0, | |
19 'forwards': 1, | |
20 'backwards': 2, | |
21 'both': 3, | |
22 'auto': 4 | |
23 }; | |
24 | |
25 /** | |
26 * @enum {number} | |
27 * @see https://w3c.github.io/web-animations/#enumdef-playbackdirection | |
28 */ | |
29 var PlaybackDirection = { | |
30 'normal': 0, | |
31 'reverse': 1, | |
32 'alternate': 2, | |
33 'alternate-reverse': 3 | |
34 }; | |
35 | |
36 /** | |
37 * @constructor | |
38 * @param {!Event} event | |
39 */ | |
40 var EventHandlerNonNull = function(event) {}; | |
41 | |
42 /** @typedef {?EventHandlerNonNull} */ | |
43 var EventHandler; | |
44 | |
45 /** | |
46 * @constructor | |
47 * @see https://w3c.github.io/web-animations/#dictdef-keyframeanimationoptions | |
48 */ | |
49 var KeyframeAnimationOptions = function() {}; | |
50 | |
51 /** | |
52 * @constructor | |
53 * @see https://w3c.github.io/web-animations/#dictdef-keyframeeffectoptions | |
54 */ | |
55 var KeyframeEffectOptions = function() {}; | |
56 | |
57 /** @type {number} */ | |
58 KeyframeEffectOptions.prototype.delay; | |
59 | |
60 /** @type {number} */ | |
61 KeyframeEffectOptions.prototype.endDelay; | |
62 | |
63 /** @type {!FillMode} */ | |
64 KeyframeEffectOptions.prototype.fill; | |
65 | |
66 /** @type {number} */ | |
67 KeyframeEffectOptions.prototype.iterationStart; | |
68 | |
69 /** @type {number} */ | |
70 KeyframeEffectOptions.prototype.iterations; | |
71 | |
72 /** @type {number|string} */ | |
73 KeyframeEffectOptions.prototype.duration; | |
74 | |
75 /** @type {number} */ | |
76 KeyframeEffectOptions.prototype.playbackRate; | |
77 | |
78 /** @type {!PlaybackDirection} */ | |
79 KeyframeEffectOptions.prototype.direction; | |
80 | |
81 /** @type {string} */ | |
82 KeyframeEffectOptions.prototype.easing; | |
83 | |
84 /** @type {string} */ | |
85 KeyframeEffectOptions.prototype.id; | |
86 | |
87 /** | |
88 * @interface | |
89 * @extends {EventTarget} | |
90 * @see https://w3c.github.io/web-animations/#animation | |
91 */ | |
92 var Animation = function() {}; | |
93 | |
94 /** @type {string} */ | |
95 Animation.prototype.id; | |
96 | |
97 /** @type {?number} */ | |
98 Animation.prototype.startTime; | |
99 | |
100 /** @type {?number} */ | |
101 Animation.prototype.currentTime; | |
102 | |
103 /** @type {number} */ | |
104 Animation.prototype.playbackRate; | |
105 | |
106 Animation.prototype.finish = function() {}; | |
107 | |
108 Animation.prototype.play = function() {}; | |
109 | |
110 Animation.prototype.pause = function() {}; | |
111 | |
112 Animation.prototype.reverse = function() {}; | |
113 | |
114 Animation.prototype.cancel = function() {}; | |
115 | |
116 /** | |
117 * @param {boolean=} opt_useCapture | |
118 * @override | |
119 */ | |
120 Animation.prototype.addEventListener = function( | |
121 type, listener, opt_useCapture) {}; | |
122 | |
123 /** @type {EventHandler} */ | |
124 Animation.prototype.onfinish; | |
125 | |
126 /** @type {EventHandler} */ | |
127 Animation.prototype.oncancel; | |
128 | |
129 /** | |
130 * @interface | |
131 * @see https://w3c.github.io/web-animations/#animatable | |
132 */ | |
133 function Animatable() {} | |
Dan Beam
2016/03/16 00:23:14
out of curiosity, why not var Animatable = functio
michaelpg
2016/03/16 03:11:15
dunno, switched it to that.
| |
134 | |
135 Animatable.prototype = /** @lends {Element.prototype} */({ | |
136 /** | |
137 * @param {?Array<Object>|Object} effect | |
138 * @param {number|!KeyframeEffectOptions=} opt_timing | |
139 * @return {!Animation} | |
140 */ | |
141 animate: function(effect, opt_timing) {}, | |
142 }); | |
OLD | NEW |