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 cr.define('settings.animation', function() { |
| 6 'use strict'; |
| 7 |
| 8 /** |
| 9 * An AnimationGroup manages a set of animations, handles any styling setup or |
| 10 * cleanup, and provides a Promise for chaining actions on finish or cancel. |
| 11 * This abstracts out all these details so UI elements can simply create an |
| 12 * object rather than individually track the state of every element, style and |
| 13 * web animation. AnimationGroups may compose web animations and other |
| 14 * AnimationGroups. |
| 15 * @interface |
| 16 */ |
| 17 function AnimationGroup() {} |
| 18 |
| 19 AnimationGroup.prototype = { |
| 20 /** |
| 21 * Sets up and plays the animation(s). |
| 22 * @return {!Promise} Convenient reference to |finished| for chaining. |
| 23 */ |
| 24 play: assertNotReached, |
| 25 |
| 26 /** |
| 27 * If animations are still playing, immediately finishes them and resolves |
| 28 * |finished|. |
| 29 */ |
| 30 finish: assertNotReached, |
| 31 |
| 32 /** |
| 33 * If animations are still playing, immediately cancels them and rejects |
| 34 * |finished|. |
| 35 */ |
| 36 cancel: assertNotReached, |
| 37 |
| 38 /** |
| 39 * Resolved or rejected when the the AnimationGroup finishes or is canceled. |
| 40 * @type {?Promise} |
| 41 */ |
| 42 finished: null, |
| 43 }; |
| 44 |
| 45 return { |
| 46 AnimationGroup: AnimationGroup, |
| 47 }; |
| 48 }); |
OLD | NEW |