Originariamente inviato da fluo
mi spieghereste che formula di movimento è quella utilizzata in questo script? Cioè, il meccanismo logico in base al quale fa muovere lo slider. Come funziona il tutto? Cos'è il damping?
note: La variabile newY viene passata alla pressione di un pulsante, ad es.: on (release) {slider.newY = [qui la coordinata _y]}
Sotto ho inserito la mia alternativa di un semplice easing.
-----------
onClipEvent (load) {
var a = 1; // accelerazione - between 1.1-10
var d = 2.5; // damping - between 1.1 - 4
var newY = _y;
var oYPos = _y;
var myYspeed = 0;
}
onClipEvent (enterFrame) {
//E' QUESTA SOTTO LA FORMULA DI CUI VORREI CAPIRE IL FUNZIONAMENTO...
// this is the movement code - it takes the curent position and the
//variable "newY" and will decelerate the object to the new point
myYspeed = ((_y-newY)/a+myYspeed)/d;
_y -= myYspeed;
// formula semplice di easing
//_y += (newY - _y)/a
}