1 goog.provide('lime.transitions.Transition');
  2 
  3 /**
  4  * Animation for switching active scenes
  5  * @param {lime.Scene} outgoing Outgoing scene.
  6  * @param {lime.Scene} incoming Incoming scene.
  7  * @constructor
  8  * extends goog.events.EventTarget
  9  */
 10 lime.transitions.Transition = function(outgoing, incoming) {
 11     goog.events.EventTarget.call(this);
 12 
 13     this.duration_ = 1.0; //sec
 14 
 15     this.outgoing_ = outgoing;
 16     this.incoming_ = incoming;
 17 
 18     this.finished_ = false;
 19 };
 20 goog.inherits(lime.transitions.Transition,goog.events.EventTarget);
 21 
 22 /**
 23  * Returns the animation duration in seconds.
 24  * @return {number} duration.
 25  */
 26 lime.transitions.Transition.prototype.getDuration = function() {
 27     return this.duration_;
 28 };
 29 
 30 /**
 31  * Set the duration of the transition.
 32  * @param {number} value New duration.
 33  * @return {lime.transitions.Transition} object itself.
 34  */
 35 lime.transitions.Transition.prototype.setDuration = function(value) {
 36     this.duration_ = value;
 37     return this;
 38 };
 39 
 40 /**
 41  * Set finish callback for transition. This function will be called
 42  * after the transition has finished. DEPRECATED! Use event listeners instead.
 43  * @deprecated
 44  * @param {function()} value Callback.
 45  * @return {lime.transitions.Transition} object itself.
 46  */
 47 lime.transitions.Transition.prototype.setFinishCallback = function(value) {
 48     if(goog.DEBUG && console && console.warn){
 49         console.warn('Transition.prototype.setFinishCallback() is deprecated. Use event listeners.');
 50     }
 51     return this;
 52 };
 53 
 54 /**
 55  * Start the transition animation.
 56  */
 57 lime.transitions.Transition.prototype.start = function() {
 58 
 59     this.incoming_.setPosition(new goog.math.Coordinate(0, 0));
 60     this.incoming_.setHidden(false);
 61     this.finish();
 62 };
 63 
 64 /**
 65  * Complete the transition animation
 66  */
 67 lime.transitions.Transition.prototype.finish = function() {
 68     this.dispatchEvent(new goog.events.Event('end'));
 69     this.finished_ = true;
 70 };
 71