Actionscript:
-
var xp:Number=0,yp:Number=0;
-
var r:Number=0,t:Number=0;
-
var speed:Number=.01;
-
var scale:Number=10;
-
var shape:Shape = Shape(addChild(new Shape()));
-
shape.x=stage.stageWidth/2;
-
shape.y=stage.stageHeight/2;
-
shape.graphics.lineStyle(0,0x000000);
-
-
var s:Number=100;
-
var range:Number=.2;
-
var b:Number=20;
-
var a:Number =b*range;
-
-
addEventListener(Event.ENTER_FRAME, onLoop);
-
function onLoop(evt:Event):void {
-
range=.2;
-
b=20;
-
a=b*range;
-
t=0;
-
shape.graphics.clear();
-
shape.graphics.lineStyle(0,0);
-
for (var i:int = 0; i<6000; i++) {
-
var sin:Number=Math.cos(t*int(mouseY/20));
-
r = Math.sqrt(40 * b * (b - a * (Math.pow(sin, int(mouseX/20)))));
-
xp=r*Math.cos(t);
-
yp=r*Math.sin(t);
-
-
if (t==0) {
-
shape.graphics.lineStyle(0, 0);
-
shape.graphics.moveTo(xp, yp);
-
} else {
-
shape.graphics.lineTo(xp, yp);
-
}
-
t+=speed;
-
if (t> (2 * Math.PI + speed)) {
-
range+=.3;
-
a=b*range;
-
t=0;
-
}
-
}
-
}
This is an example of raw messy code that draws some interesting shapes. I was waiting somewhere with my laptop a few weeks back and I wrote this and e-mailed this to myself - it's completely unoptimized and unedited.
I was working on documentation for QuickBox2D today but didn't finish it - so I posted this instead. I hope to finish the docs for tomorrow...