root / trunk / web / dojo / dojox / fx / ext-dojo / reverse.js @ 13
History | View | Annotate | Download (1.36 KB)
| 1 | 
      /*
     | 
  
|---|---|
| 2 | 
              Copyright (c) 2004-2010, The Dojo Foundation All Rights Reserved.
     | 
  
| 3 | 
              Available via Academic Free License >= 2.1 OR the modified BSD license.
     | 
  
| 4 | 
              see: http://dojotoolkit.org/license for details
     | 
  
| 5 | 
      */
     | 
  
| 6 | 
       | 
  
| 7 | 
       | 
  
| 8 | 
      if(!dojo._hasResource["dojox.fx.ext-dojo.reverse"]){  | 
  
| 9 | 
      dojo._hasResource["dojox.fx.ext-dojo.reverse"]=true;  | 
  
| 10 | 
      dojo.provide("dojox.fx.ext-dojo.reverse");
     | 
  
| 11 | 
      dojo.require("dojo.fx.easing");
     | 
  
| 12 | 
      dojo.require("dojo.fx");
     | 
  
| 13 | 
      dojo.extend(dojo.Animation,{_reversed:false,reverse:function(_1,_2){
     | 
  
| 14 | 
      var _3=this.status()=="playing";  | 
  
| 15 | 
      this.pause();
     | 
  
| 16 | 
      this._reversed=!this._reversed;  | 
  
| 17 | 
      var d=this.duration,_4=d*this._percent,_5=d-_4,_6=new Date().valueOf(),cp=this.curve._properties,p=this.properties,nm;  | 
  
| 18 | 
      this._endTime=_6+_4;
     | 
  
| 19 | 
      this._startTime=_6-_5;
     | 
  
| 20 | 
      if(_3){
     | 
  
| 21 | 
      this.gotoPercent(_5/d);
     | 
  
| 22 | 
      }  | 
  
| 23 | 
      for(nm in p){  | 
  
| 24 | 
      var _7=p[nm].start;
     | 
  
| 25 | 
      p[nm].start=cp[nm].start=p[nm].end;  | 
  
| 26 | 
      p[nm].end=cp[nm].end=_7;  | 
  
| 27 | 
      }  | 
  
| 28 | 
      if(this._reversed){  | 
  
| 29 | 
      if(!this.rEase){  | 
  
| 30 | 
      this.fEase=this.easing;  | 
  
| 31 | 
      if(_2){
     | 
  
| 32 | 
      this.rEase=_2;
     | 
  
| 33 | 
      }else{
     | 
  
| 34 | 
      var de=dojo.fx.easing,_8,_9;
     | 
  
| 35 | 
      for(nm in de){  | 
  
| 36 | 
      if(this.easing==de[nm]){  | 
  
| 37 | 
      _8=nm;  | 
  
| 38 | 
      break;
     | 
  
| 39 | 
      }  | 
  
| 40 | 
      }  | 
  
| 41 | 
      if(_8){
     | 
  
| 42 | 
      if(/InOut/.test(nm)||!/In|Out/i.test(nm)){  | 
  
| 43 | 
      this.rEase=this.easing;  | 
  
| 44 | 
      }else{
     | 
  
| 45 | 
      if(/In/.test(nm)){  | 
  
| 46 | 
      _9=nm.replace("In","Out");  | 
  
| 47 | 
      }else{
     | 
  
| 48 | 
      _9=nm.replace("Out","In");  | 
  
| 49 | 
      }  | 
  
| 50 | 
      }  | 
  
| 51 | 
      if(_9){
     | 
  
| 52 | 
      this.rEase=dojo.fx.easing[_9];
     | 
  
| 53 | 
      }  | 
  
| 54 | 
      }else{
     | 
  
| 55 | 
      this.rEase=this.easing;  | 
  
| 56 | 
      }  | 
  
| 57 | 
      }  | 
  
| 58 | 
      }  | 
  
| 59 | 
      this.easing=this.rEase;  | 
  
| 60 | 
      }else{
     | 
  
| 61 | 
      this.easing=this.fEase;  | 
  
| 62 | 
      }  | 
  
| 63 | 
      if(!_1&&this.status()!="playing"){  | 
  
| 64 | 
      this.play();
     | 
  
| 65 | 
      }  | 
  
| 66 | 
      return this;  | 
  
| 67 | 
      }});  | 
  
| 68 | 
      }  |