|
-
Changing a AS objects diameter of rotation dependant on position of mouse
Hi guys,
This is for a personal art project, however I have hit a potential (Actionscript) brick wall!
I want the diameter of the 'balls' orbit to change dependant on the position of the mouse but keep the point of rotation exactly the middle of the stage at all times.
I.e. if the mouse is hovering over the exact center (both X+Y) of the stage then the 'ball' should have a tiny diameter of rotation (but contstantly follows the orbit in clockwise direction) whilst if you move the mouse towards the edge of the stage then the diameter of the orbit of the ball will increase.
Here is the AS which controls a blank movieclip;
var sp:Sprite = new Sprite();
orb1.addChild(sp)
var g: Graphics =sp.graphics
orb1.x = (stage.mouseX);
orb1.y = (stage.mouseY);
g.moveTo(stage.mouseX, stage.mouseY);
//stage.stageWidth/2,stage.stageHeight/2)
g.lineStyle(1.5,0x000000,10);
g.beginFill(0x000000,0.2)
g.drawCircle(stage.mouseX,stage.mouseY,10)
g.endFill();
stage.addEventListener(Event.ENTER_FRAME,test)
stop();
function test(Evt:Event):void{
orb1.rotation +=5;
orb1.x = (stage.mouseX);
orb1.y = (stage.mouseY);
}
If it help's, here is the .swf, .fla AND an image with an explanation:
http://www.taylormadeclubbing.co.uk/flash/test.swf
http://www.taylormadeclubbing.co.uk/flash/test.png
http://www.taylormadeclubbing.co.uk/flash/test.fla
Hope this helps!
Tags for this Thread
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|