Ciao ho questo prototipo per il moto elastico
codice:
MovieClip.prototype.elastic = function(x, y, acc, inrz) {
var spostamento_x = 0;
var spostamento_y = 0;
var checkpos = Array();
var remember = 1;
this.onEnterFrame = function() {
spostamento_x = (spostamento_x + (x - this._x) /acc) / inrz;
spostamento_y = (spostamento_y + (y - this._y) / acc) / inrz;
this._x += spostamento_x;
this._y += spostamento_y;
if( checkpos[remember-1] == (this._x+this._y) ) {
remember = 1;
delete this.onEnterFrame;
}
else {
checkpos[remember] = (this._x+this._y);
remember++;
}
}
}
Ora sapendo che la formula del moto decellerato è
codice:
spostamento = (fine - inizio)/frame
Qualcuno sarebbe in grado di convertirmi il prototype sopra per il moto decellerato?