Actionscript:
-
[SWF(width = 600, height = 600)]
-
var a:Number = 0.02;
-
var b:Number = .9998;
-
-
var xn1:Number = 5;
-
var yn1:Number = 0;
-
var xn:Number, yn:Number;
-
-
var scale:Number = 10;
-
var iterations:Number = 20000;
-
var step:Number = stage.stageWidth / iterations;
-
-
function f(x:Number):Number{
-
var x2:Number = x * x;
-
return a * x + (2 * (1 - a) * x2) / (1 + x2);
-
}
-
-
var canvas:BitmapData = Bitmap(addChild(new Bitmap(new BitmapData(600,600,false,0xEFEFEF)))).bitmapData;
-
-
var circle = new Sprite();
-
with(circle.graphics) beginFill(0, 0.3), drawCircle(2,2,1);
-
-
var dot:BitmapData = new BitmapData(4,4,true, 0x00000000);
-
dot.draw(circle);
-
-
var pnt:Point = new Point();
-
-
var txt:TextField = TextField(addChild(new TextField()));
-
txt.text = "move mouse";
-
-
addEventListener(Event.ENTER_FRAME, onLoop);
-
function onLoop(evt:Event):void {
-
-
canvas.fillRect(canvas.rect, 0xEFEFEF);
-
-
a = mouseY / 1000;
-
xn1 = mouseX / 30;
-
yn1 = 0;
-
for (var i:int = 0; i<iterations; i++){
-
xn = xn1;
-
yn = yn1;
-
-
xn1 = b * yn + f(xn);
-
yn1 = -xn + f(xn1);
-
pnt.x = i * step;
-
pnt.y = 300 + yn1 * scale;
-
canvas.copyPixels(dot, dot.rect, pnt, null, null, true);
-
-
}
-
}
Try it out:
Gumowski Mira Pseudo-soundwave - wonderfl build flash online