forked from: Logistic equation

by greentec forked from Logistic equation (diff: 12)
♥0 | Line 36 | Modified 2011-02-06 22:37:53 | MIT License
play

ActionScript3 source code

/**
 * Copyright greentec ( http://wonderfl.net/user/greentec )
 * MIT License ( http://www.opensource.org/licenses/mit-license.php )
 * Downloaded from: http://wonderfl.net/c/h09E
 */

// forked from greentec's Logistic equation
package {
    import flash.display.Sprite;
    import flash.text.*;

    public class FlashTest extends Sprite {
        public function FlashTest() {
            var xst_:int=30;
            var yst_:int=300;
            var i:uint;
            var n:uint=250;
            var val:Number=0.5+Math.random()*0.5;
            
            graphics.lineStyle(0,0,1);
            graphics.moveTo(xst_,yst_);
           
            for(i=0;i<n;i++)
            {
                if(val>0.5)
                {
                    val=2*val*(1-val);
                }
                else
                {
                    val*=2;
                }

                graphics.lineTo(xst_+i*1.5,yst_-(val*200));
            }
            var f:TextFormat=new TextFormat();
            f.size=20;
            var t:TextField=new TextField();
            t.defaultTextFormat=f;
            t.width=300;
            t.text="y=2x(1-x) or 2x : tent transformation";
            
            t.x=40;
            t.y=330;
            addChild(t);
            

            
        }
    }
}