Bueno termine el animate.
Les dejo el link para que vean y el codigo:
http://halfmusic.com.ar/animate-finisch.html
Código javascript
:
Ver original<script>
var transicionAnimate=function(curva,ms,callback,onDone){
this.ant=0.01;this.done_=false;var _this=this;this.start=new Date().getTime();this.init=function(){
setTimeout(function(){
if(!_this.next()){
callback(1);_this.done_=true;(onDone?onDone():function(){
}
);window.globalIntervalo=0;return;}
callback(_this.next());_this.init();
},13);};
this.next=function(){
var now=new Date().getTime();if((now-this.start)>ms)return false;return this.ant=curva((now-this.start+.001)/ms,this.ant);}
}
var senoidal=function(p,ant){return (1 - Math.cos(p * Math.PI)) / 2;}
var fxAnimate=function(obj,efectos,ms,cola,curva,inicio,onDone){
_this=this;
if(!window.globalIntervalo)
window.globalIntervalo=1;
else{
if(cola)
return setTimeout(function(){_this.fxAnimate(obj,efectos,ms,cola,curva,inicio,onDone)},30);
else
return;
}
var t=new this.transicionAnimate(curva,ms,function(p){
for(at in efectos){
if(efectos[at]<inicio[at]){
var delta=parseInt(inicio[at]-efectos[at]);
if(at=="opacity"){
obj.style.opacity=(parseInt(inicio[at]-parseInt(p*delta)));
obj.style.MozOpacity=(parseInt(inicio[at])-parseInt(p*delta));
obj.style.KhtmlOpacity=(parseInt(inicio[at])-parseInt(p*delta));
obj.style.filter="alpha(opacity="+(parseInt(inicio[at])-parseInt(p*delta))*100+")";
obj.style.zoom=1;
}else{
obj.style[at] = (parseInt(inicio[at])-parseInt(p*delta));
}
}else{
var delta=parseInt(efectos[at]-inicio[at]);
if(at=="opacity"){
obj.style.opacity=(parseInt(inicio[at])+parseInt(p*delta));
obj.style.MozOpacity=(parseInt(inicio[at])+parseInt(p*delta));
obj.style.KhtmlOpacity=(parseInt(inicio[at])+parseInt(p*delta));
obj.style.filter="alpha(opacity="+(parseInt(inicio[at])+parseInt(p*delta))*100+")";
obj.style.zoom=1;
}else{
obj.style[at] = (parseInt(inicio[at])+parseInt(p*delta));
}
}
}
},onDone);t.init();t=null;
}
var animate=function(_this,op,time,onDone){time=!time?200:time;inicia={};for(at in op){inicia[at]=_this.style[at].replace('px','');}this.fxAnimate(_this,op,time,true,senoidal,inicia,onDone);}
function animar(_this){
animate(_this,{'height':50,'width':100,'opacity':0.5},null,function(){alert('Fin!');});
}
</script>
<div style="height:200px; width:300px; background-color:#006699;opacity:1;" onClick="animar(this);">Click para animar!</div>
Gracias
Salu2
PD: No anda el
opacity. Si alguien sabe como hacerlo andar, por favor digalo (: