Ver Mensaje Individual
  #5 (permalink)  
Antiguo 06/05/2009, 14:46
Avatar de pato12
pato12
 
Fecha de Ingreso: septiembre-2007
Ubicación: Salta
Mensajes: 1.620
Antigüedad: 16 años, 7 meses
Puntos: 101
Respuesta: Animate como en jQuery

Hola,
Este es mi codigo del animate:
Código javascript:
Ver original
  1. transicionAnimate:function(curva,ms,callback){
  2.     this.ant=0.01;
  3.     this.done_=false;
  4.     var _this=this;
  5.     this.start=new Date().getTime();
  6.     this.init=function(){
  7.         setTimeout(function(){
  8.                 if(!_this.next()){
  9.                     callback(1);
  10.                     _this.done_=true;
  11.                     window.globalIntervalo=0;
  12.                     return;
  13.                 }
  14.                 callback(_this.next());
  15.                 _this.init();
  16.             },13);
  17.     }
  18.     this.next=function(){
  19.         var now=new Date().getTime();
  20.         if((now-this.start)>ms)
  21.             return false;
  22.         return this.ant=curva((now-this.start+.001)/ms,this.ant);
  23.     }
  24. },
  25. senoidal:function(p,ant){return (1 - Math.cos(p * Math.PI)) / 2;},
  26. fxAnimate:function(obj,efectos,ms,cola,curva){
  27.     if(!window.globalIntervalo)
  28.         window.globalIntervalo=1;
  29.         else{
  30.             if(cola)
  31.                 return setTimeout(function(){this.fxAnimate(obj,efectos,ms,cola,curva)},30);
  32.             else
  33.                 return;
  34.     }  
  35.     var t=new this.transicionAnimate(
  36.     curva,ms,function(p){
  37.         for(at in efectos){
  38.             if(efectos[at]<obj.css(at)){
  39.                 var delta=obj.css(at)-efectos[at];
  40.                 obj.css(at,(obj.css(at)-(p*delta)));
  41.             }else{
  42.                 var delta=efectos[at]-obj.css(at);
  43.                 obj.css(at,(obj.css(at)+(p*delta)));
  44.             }
  45.         }
  46.     });
  47.     t.init();
  48.     t=null;
  49. },
  50. animate:function(op,time){this.fxAnimate(this,op,time,true,this.senoidal);}
Pero no anda bin :(
Me lo hace muy grande (miles de veses mas) y resien al fina me lo hace del tamaño que le di.
Gracias
Salu2
PD: css() es una funcion parecida a jquey.

{EDITO}
Aqui esta el link de una demo:
http://halfmusic.com.ar/animate.html
__________________
Half Music - www.halfmusic.com

Última edición por pato12; 06/05/2009 a las 14:53 Razón: Poner link