does anybody know how to make a decelerating spring effect? what i want is to have a ball that goes to a target using the spring effect (ie it goes a bit further than the target and springs back a bit before a few times decreasing each time the distance - giving a spring effect) - but what i also want is that as it goes to the first position where it ‘springs’ back for the ball to decelerate!
I can do the spring - i can do the deceleration - but I dont know how to do the 2 together - :h:
// my spring effect -
onClipEvent (load) {
this._y = 200;
this._x = 100;
targetX = 300;
mover = 0;
loop = 0;
}
onClipEvent (enterFrame) {
if (_root.go == 1) {
mover = mover+(targetX-this._x)/2;
mover=mover *.6;
this._x = this._x+mover;
loop=loop+1;
_root.where=_x;
}
}
// my deceleration
onClipEvent (load) {
movedx = 0;
targetX = 300;
}
onClipEvent (enterFrame) {
distX = targetX-this._x;
totalDistance = Math.sqrt(distXdistX);
this._x += distXspeed;
if (totalDistance<1) {
this._x = targetX;
}
}
Any help much appreciated!