In case Flash no longer exists; a copy of this site is included in the Flashpoint archive's "ultimate" collection.

Dead Code Preservation :: Archived AS3 works from wonderfl.net

Gumowski Mira Pseudo-soundwave

move your mouse
Get Adobe Flash player
by shapevent 30 Jun 2012
/**
 * Copyright shapevent ( http://wonderfl.net/user/shapevent )
 * MIT License ( http://www.opensource.org/licenses/mit-license.php )
 * Downloaded from: http://wonderfl.net/c/2xQo
 */

package {
    import flash.display.*;
    import flash.events.*;
    import flash.geom.*;
    import flash.text.*;
    public class FlashTest extends Sprite {
        public function FlashTest() {
            
         
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(500,500,false,0xEFEFEF)))).bitmapData;

var circle:Sprite = 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 = 250 + yn1 * scale;
		  canvas.copyPixels(dot, dot.rect, pnt, null, null, true);
		
    }
}
            
        }
    }
}