Actionscript:
-
x=stage.stageWidth/2;
-
y=stage.stageHeight/2;
-
var xp:Number = 0, yp:Number = 0;
-
var r:Number = 0, t:Number = 0;
-
var speed:Number=.1;
-
-
var range:Number=.2;
-
var b:Number = 20;
-
var a:Number = b * range;
-
var orbit:Number = 2 * Math.PI + speed;
-
-
graphics.lineStyle(0,0x000000);
-
-
addEventListener(Event.ENTER_FRAME, onLoop);
-
function onLoop(evt:Event):void {
-
var sin:Number=Math.sin(t);
-
r = Math.sqrt(4 * b * (a - b * (sin * sin)));
-
xp= r * Math.cos(t);
-
yp= r * sin;
-
-
if (t==0) {
-
graphics.moveTo(xp, yp);
-
} else {
-
graphics.lineTo(xp, yp);
-
}
-
-
t += speed;
-
-
if (t> orbit) {
-
range += .5;
-
a= b * range;
-
t= 0;
-
}
-
}
The above draws a Hippopede