transition.js 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  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. * @fileoverview An interface for transition animation. This is a simple
  16. * interface that allows for playing and stopping a transition. It adds
  17. * a simple event model with BEGIN and END event.
  18. *
  19. * @author chrishenry@google.com (Chris Henry)
  20. */
  21. goog.provide('goog.fx.Transition');
  22. goog.provide('goog.fx.Transition.EventType');
  23. /**
  24. * An interface for programmatic transition. Must extend
  25. * {@code goog.events.EventTarget}.
  26. * @interface
  27. */
  28. goog.fx.Transition = function() {};
  29. /**
  30. * Transition event types.
  31. * @enum {string}
  32. */
  33. goog.fx.Transition.EventType = {
  34. /** Dispatched when played for the first time OR when it is resumed. */
  35. PLAY: 'play',
  36. /** Dispatched only when the animation starts from the beginning. */
  37. BEGIN: 'begin',
  38. /** Dispatched only when animation is restarted after a pause. */
  39. RESUME: 'resume',
  40. /**
  41. * Dispatched when animation comes to the end of its duration OR stop
  42. * is called.
  43. */
  44. END: 'end',
  45. /** Dispatched only when stop is called. */
  46. STOP: 'stop',
  47. /** Dispatched only when animation comes to its end naturally. */
  48. FINISH: 'finish',
  49. /** Dispatched when an animation is paused. */
  50. PAUSE: 'pause'
  51. };
  52. /**
  53. * @type {function()}
  54. * Plays the transition.
  55. */
  56. goog.fx.Transition.prototype.play;
  57. /**
  58. * @type {function()}
  59. * Stops the transition.
  60. */
  61. goog.fx.Transition.prototype.stop;