MathTest
♥0 |
Line 32 |
Modified 2010-10-16 00:30:03 |
MIT License
archived:2017-03-20 03:25:30
ActionScript3 source code
/**
* Copyright pitombo ( http://wonderfl.net/user/pitombo )
* MIT License ( http://www.opensource.org/licenses/mit-license.php )
* Downloaded from: http://wonderfl.net/c/pm8g
*/
package
{
import flash.events.Event;
import flash.display.Sprite;
[SWF(backgroundColor="#000000",frameRate="40")]
public class MathTest extends Sprite {
private var circle:Sprite;
public function MathTest() {
createCircle();
addEventListener(Event.ENTER_FRAME, loop, false,0,true);
}
private function loop(e:Event):void
{
var c:Number = Math.atan2(mouseY - (stage.stageHeight/2), mouseX - (stage.stageWidth/2));
circle.x = (stage.stageWidth/2) + Math.cos(c) * 200;
circle.y = (stage.stageHeight/2) + Math.sin(c) * 200;
graphics.clear();
graphics.lineStyle(1,0xFF0000);
graphics.moveTo(mouseX,mouseY);
graphics.lineTo(circle.x, circle.y);
graphics.endFill();
}
private function createCircle():void
{
circle = new Sprite();
circle.graphics.lineStyle(1,0xFF0000);
circle.graphics.drawEllipse(-10,-10,20,20);
circle.graphics.endFill();
addChild(circle);
}
}
}