1 // ==========================================================================
  2 // Project:   SproutCore
  3 // Copyright: @2013 7x7 Software, Inc.
  4 // License:   Licensed under MIT license (see license.js)
  5 // ==========================================================================
  6 
  7 
  8 SC.mixin(SC.View,
  9   /** @scope SC.View */ {
 10 
 11   /** @class
 12 
 13     @extends SC.ViewTransitionProtocol
 14     @since Version 1.10
 15   */
 16   SCALE_IN: {
 17 
 18     /* @private */
 19     layoutProperties: ['scale'],
 20 
 21     /** @private */
 22     setup: function (view, options, inPlace) {
 23       view.adjust({ scale: inPlace ? view.get('layout').scale || 0 : 0 });
 24     },
 25 
 26     /** @private */
 27     run: function (view, options, finalLayout, finalFrame) {
 28       view.animate('scale', finalLayout.scale || 1, {
 29         delay: options.delay || 0,
 30         duration: options.duration || 0.4,
 31         timing: options.timing || 'ease'
 32       }, function (data) {
 33         if (!data.isCancelled) {
 34           this.didTransitionIn();
 35         }
 36       });
 37     }
 38   },
 39 
 40   /** @class
 41 
 42     @extends SC.ViewTransitionProtocol
 43     @since Version 1.10
 44   */
 45   SCALE_OUT: {
 46 
 47     /* @private */
 48     layoutProperties: ['scale'],
 49 
 50     /** @private */
 51     run: function (view, options) {
 52       view.animate('scale', 0, {
 53         delay: options.delay || 0,
 54         duration: options.duration || 0.4,
 55         timing: options.timing || 'ease'
 56       }, function (data) {
 57         if (!data.isCancelled) {
 58           this.didTransitionOut();
 59         }
 60       });
 61     }
 62 
 63   }
 64 });
 65