Tutorial Navigation
 

     
 Links
 

 
.

 

 Search         Date   
      

SwishMax
:  Mouse Follow with Easing, 
April 12, 2004  -  by Pemtium  
 
Simple Tutorial to create an easing effect for a mouse follower:
Sample: (Move mouse all over the Square below)









The Actionscript needit on the object tha will follow the cursor.

onLoad () {
    _x = 60;
    _y = 60;
    speedREV = 15;
}
onEnterFrame() {
    MX = _root._xmouse;
    _x += (MX - _x) / speedREV;

    MY = _root._ymouse;
    _y += (MY - _y) / speedREV;
}

speedREV=15  is the speed that the follower use to move.
1=Faster ..... 1000=Slow in our sample the blue ball is using speedREV=15 and the orange ball use  speedREV=100. MX and MY has the current position of the cursor.  
_x += (MX - _x) / speedREV this sentence is used to lower  the speed when the object is close to the cursor. Object could be Text, Image or any object.

    Total Download: 65 Last Download: 13/01/2010

.

     
 Featured Links