Actionscript:
-
var xp:Number = 0;
-
var yp:Number = 0;
-
var t:Number = 0;
-
var a:Number = 100;
-
var b:Number = 10;
-
x = stage.stageWidth / 2;
-
y = stage.stageHeight / 2;
-
-
graphics.lineStyle(0,0x000000);
-
addEventListener(Event.ENTER_FRAME, onRun);
-
function onRun(evt:Event):void {
-
var p:Number = ((a + b)/b)*t
-
xp = (a + b) * Math.cos(t) - b * Math.cos(p);
-
yp = (a + b) * Math.sin(t) - b * Math.sin(p);
-
if (t == 0){
-
graphics.moveTo(xp, yp);
-
}else{
-
graphics.lineTo(xp, yp);
-
}
-
t += 0.05;
-
}
I've messed with Epicycloids in the past - browsing mathworld I decided to create this snippet. It will draw a curve like this:
One Comment
cool,Cheer up