| 1 |
// Copyright 2011 The Closure Library Authors. All Rights Reserved. |
| 2 |
// |
| 3 |
// Licensed under the Apache License, Version 2.0 (the "License"); |
| 4 |
// you may not use this file except in compliance with the License. |
| 5 |
// You may obtain a copy of the License at |
| 6 |
// |
| 7 |
// http://www.apache.org/licenses/LICENSE-2.0 |
| 8 |
// |
| 9 |
// Unless required by applicable law or agreed to in writing, software |
| 10 |
// distributed under the License is distributed on an "AS-IS" BASIS, |
| 11 |
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 12 |
// See the License for the specific language governing permissions and |
| 13 |
// limitations under the License. |
| 14 |
|
| 15 |
/** |
| 16 |
* @fileoverview An interface for transition animation. This is a simple |
| 17 |
* interface that allows for playing and stopping a transition. It adds |
| 18 |
* a simple event model with BEGIN and END event. |
| 19 |
* |
| 20 |
* @author [email protected] (Chris Henry) |
| 21 |
*/ |
| 22 |
|
| 23 |
goog.provide('goog.fx.Transition'); |
| 24 |
goog.provide('goog.fx.Transition.EventType'); |
| 25 |
|
| 26 |
|
| 27 |
|
| 28 |
/** |
| 29 |
* An interface for programmatic transition. Must extend |
| 30 |
* {@code goog.events.EventTarget}. |
| 31 |
* @interface |
| 32 |
*/ |
| 33 |
goog.fx.Transition = function() {}; |
| 34 |
|
| 35 |
|
| 36 |
/** |
| 37 |
* Transition event types. |
| 38 |
* @enum {string} |
| 39 |
*/ |
| 40 |
goog.fx.Transition.EventType = { |
| 41 |
/** Dispatched when played for the first time OR when it is resumed. */ |
| 42 |
PLAY: 'play', |
| 43 |
|
| 44 |
/** Dispatched only when the animation starts from the beginning. */ |
| 45 |
BEGIN: 'begin', |
| 46 |
|
| 47 |
/** Dispatched only when animation is restarted after a pause. */ |
| 48 |
RESUME: 'resume', |
| 49 |
|
| 50 |
/** |
| 51 |
* Dispatched when animation comes to the end of its duration OR stop |
| 52 |
* is called. |
| 53 |
*/ |
| 54 |
END: 'end', |
| 55 |
|
| 56 |
/** Dispatched only when stop is called. */ |
| 57 |
STOP: 'stop', |
| 58 |
|
| 59 |
/** Dispatched only when animation comes to its end naturally. */ |
| 60 |
FINISH: 'finish', |
| 61 |
|
| 62 |
/** Dispatched when an animation is paused. */ |
| 63 |
PAUSE: 'pause' |
| 64 |
}; |
| 65 |
|
| 66 |
|
| 67 |
/** |
| 68 |
* @type {function()} |
| 69 |
* Plays the transition. |
| 70 |
*/ |
| 71 |
goog.fx.Transition.prototype.play; |
| 72 |
|
| 73 |
|
| 74 |
/** |
| 75 |
* @type {function()} |
| 76 |
* Stops the transition. |
| 77 |
*/ |
| 78 |
goog.fx.Transition.prototype.stop; |