Flash Script – Cursor Trick 2: Rotating Mouse Follower

By Georgina Laidlaw

Download the sample files here.

1. First, create a movieclip of your choice. Give the movieclip an instance name — I called mine ‘follower’.

3. In the first frame, insert the following action:

//sets the speed of rotation 
rotation_speed = 5;
//sets the elasticity the higher the value the higher the elasticity
elasticity = .1;
_root.onEnterFrame = function()
 with (follower) {
   _rotation += rotation_speed;
   _x += (_root._xmouse-_x)*elasticity;
   _y += (_root._ymouse-_y)*elasticity;

That’s it! Test the movie. Remember, you can increase the rotation_speed variable to create different effects.

No Reader comments



Learn Coding Online
Learn Web Development

Start learning web development and design for free with SitePoint Premium!

Instant Website Review

Use Woorank to analyze and optimize your website to improve your website to improve your ranking!

Run a review to see how your site can improve across 70+ metrics!

Get the latest in Front-end, once a week, for free.