Prototipo de Easing.
jueves, julio 28, 2005 @17:55
Los parametros serán los siguientes:
- property: cadena de texto incluyendo el nombre de la propiedad, por ejemplo: "_alpha"
- target: valor objetivo de la propiedad
- speed: velocidad del movimiento, valor entre 0 y 1 ( valor más alto para velocidad más rapida )
- delay: tiempo de retardo antes de que empiece el movimiento (en frames).
- callback: función a llamar al acabar.
- params: parametros de la función callback.
La usaremos por ejemplo de la siguiente manera: MCinstance.ease("_xscale", 50, 0.2, 20);
MovieClip.prototype.ease=function(prop, target, speed, delay, callback, params){
var n=prop.toLowerCase().substr(1)
this[n].removeMovieClip()
this.createEmptyMovieClip(n,this.t+10)
this.t++
this[n].p=prop
this[n].t=target
this[n].s=speed
this[n].d=delay
this[n].onEnterFrame=function(){
if(this.d<1){
this._parent[this.p]+=this.s*(this.t-this._parent[this.p])
if(Math.abs(this.t-this._parent[this.p])==this.l){
this._parent[this.p]=this.t
this.onEnterFrame=null
this.removeMovieClip()
callback(params)
}
this.l=Math.abs(this.t-this._parent[this.p])
}else{
this.d--
}
}
}
Etiquetas: actionscript, flash
0 comentarios
Publicar un comentario