Easing

I couldn’t find anything in search so here it goes.

I am trying to use LBA’s tutorial on mouse follow with easing to achieve a similar effect like on http://www.mediaengine.com. Could anyone help me break this down as i’m pretty new to Action Scripting.

Thanks in advance

Joe R.

wrong section, you probally wont get any answers on this section, not to many people come here. I will contact a mod to move it to the correct place for you.:slight_smile:

thanx alex.

what are you talking about alex? i always go here :).

here’s your basic mousefollow with easing:

onClipEvent (enterFrame) {
_x += (_root._xmouse-_x)/7;
_y += (_root._ymouse-_y)/7;
}

create a movieclip symbol and insert this code in it and see what happens (Ctrl+Enter…). Ok this code basically causes the object to follow the mouse with some easing. How does this work? Well, when you add the distance between the mouse and the object to its position (eg, _x += _root._xmouse-_x;), then the object will instantly go to the mouse. to delay its travel, or ease, we divide that distance so that it will eventually end up where the mouse is, but it will take longer, depending on what value you use to ease it in (7 in this case). a higher number will take it longer to get there, whereas a lower number will move it sooner.

you don’t always have to ease to the mouse, you can do it with any other object; the basic format is:

position += (point 2 + current position) / easing

(btw, “+=” is the same thing as saying _x = _x+whatever, or _x += whatever)

i hope this helps. contact me if you still need help with easing.

thoriphes: This was posted in the “book Help section”. So i contacted Kit, and she moved it to the correct place. :slight_smile:

oh, lol. odd location indeed. :stuck_out_tongue:

on this subject
using flash5
how about easing a curved motion…

i have tried a number of things
in a movie i have where you enter the final coordinates

and have had no luck with both positions being met moving the object in a curve

you can see here, it works in a straight line fine ± a pixel
due to rounding

http://www.route108.com/soup/portfolio/controlled_motion_5.swf



onClipEvent(enterFrame) {	
	count=0;
        while (count<_root.numbDupe) {
			this.duplicateMovieClip("ball1"+count, count);
			_root.ball10._x = _root.ball1._x;
			_root.ball10._y = _root.ball1._y;
			_root.ball10._alpha = 98;
			_root["ball1"+count]._x = _root["ball1"+(count-1)]._x-(_root.tarX-_root.ball1._x)/10;
			_root["ball1"+count]._y = _root["ball1"+(count-1)]._y-(_root.tarY-_root.ball1._y)/10;
			_root["ball1"+count]._alpha = _root["ball1"+(count-1)]._alpha-2;
			count += 1;
		}
        if ( _root.curX != _root.tarX && _root.curY != _root.tarY) {
                this._x += (_root.tarX - _root.curX)/10;
                this._y += (_root.tarY - _root.curY)/10;
                this._xscale =_root.curScaleX;
                this._yscale =_root.curScaleY;
		

			_root.curX = Math.round(this._x);
			_root.curY = Math.round(this._y);
			trace(_root.curX+"__"+_root.curY);

        }
		else if( _root.curX == _root.tarX or _root.curY == _root.tarY ) {

			for(i=0; i< _root.numbDupe; ++i) {
			removeMovieClip(_root["ball1"+i]);
			}

            startMove = false;

       	}

}

a bit long winded, but…

soup

Thanks for the help… For some reason I can’t get it to work. I get an error saying this action is reserved for movie instances. Which it is applied to. I probably have the layout all messed up. here is the address to my fla file. http://joe.it.pacificwebworks.com/JD/Various/testclouds2.fla Maybe you guys can see what I have done wrong. This file just has a basic mouse follow without easing. Feel free to delete it.

Thanks again for helping me, i’m a noob at this.

OH and i posted it there on mistake after reading its discription saying Post any questions or problems you may be having with any of the examples, tutorials, and more! I didn’t look at the title. So thanks again alex for getting this moved.