Edited by PixelWarrior, 02 August 2006 - 08:38 AM.
MC Scale to mouse distance.
Started by PixelWarrior, Aug 02 2006 03:16 AM
3 replies to this topic
#1
Posted 02 August 2006 - 03:16 AM
I'm trying to get a mc to get bigger as u move the mouse closer to it. Kinda like http://www.insidercl....uk/index2.html but without the button sticking to the mouse.
#2
Posted 03 August 2006 - 12:28 PM
var circle:MovieClip;
circle.onEnterFrame = function() {
var minimum_distance = 300; // the distance at which the movieclip is smallest
var minimum_scale = 10; // the scale the movieclip is when it is smallest
var x:Number = _root._xmouse-this._x;
var y:Number = _root._ymouse-this._y;
var distance:Number = Math.sqrt(x*x+y*y);
this._xscale = this._yscale = Math.max(0, minimum_distance-distance)*(100-minimum_scale)/minimum_distance+minimum_scale;
}This code will create the effect that you are after. It scales the movieclip from 100 to `minimum_scale` over a distance of `minimum_distance`.My setup is simply a movieclip on the stage with instance-name circle.
Hope this helps.
#3
Posted 04 August 2006 - 11:13 PM
Exactly what I was trying to make. Thanks heaps...
I got close to that... but yeah, not quite lol
You Rock!
I got close to that... but yeah, not quite lol
You Rock!
#4
Posted 05 August 2006 - 09:07 AM
Glad to help
1 user(s) are reading this topic
0 members, 1 guests, 0 anonymous users
