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

forked from: forked from: ◯と○

1個目 とりあえず 線を引いてみたい
/**
 * Copyright onedayitwillmake ( http://wonderfl.net/user/onedayitwillmake )
 * MIT License ( http://www.opensource.org/licenses/mit-license.php )
 * Downloaded from: http://wonderfl.net/c/xXpo
 */

// forked from gurumi's forked from: ◯と○
// forked from gurumi's ◯と○
// forked from gurumi's forked from: forked from: forked from: forked from: flash on 2009-5-9
// forked from yd_niku's forked from: forked from: forked from: flash on 2009-5-9
// forked from gurumi's forked from: forked from: flash on 2009-5-9
// forked from yd_niku's forked from: flash on 2009-5-9
// forked from qurumi's flash on 2009-5-9
// write as3 code here..
//1個目 とりあえず 線を引いてみたい

package
{    
    import flash.display.*;
    import flash.events.*;
    import flash.geom.*;
    import flash.filters.BlurFilter;
    //import caurina.transitions.Tweener;

    [SWF(frameRate="40", backgroundColor="#000000")]

    public class line_01 extends Sprite
    {
        private var container:Sprite;
        private var dot:Sprite;
        private var bmpd:BitmapData;
        private var angle:int;
        private var rd:Number;
        private var radius :int = 1;

        public function line_01()
        {
            init();            
            addEventListener(Event.ENTER_FRAME, drawline);
        }

        private function init():void
        {
            bmpd = new BitmapData(stage.stageWidth, stage.stageHeight, false, 0xFF000000 );
            container = new Sprite();
            dot = new Sprite();
            addChild(new Bitmap(bmpd));
            container.addChild(dot);
            
            with(dot.graphics)
            {			
                //for文を書く練習
                for (var i:int = 0; i<330; i++){
                beginFill((255* i/330) << 16 | 0 << 8 | 200);
                drawCircle(i, 40, 3);
                endFill();
                }
             }            
            
            //フィルタ
            dot.filters = [blur];
              dot.x = 0
              dot.y = 225
        }
        private  var blur:BlurFilter=new BlurFilter(4,4);
        private var colorTransform:ColorTransform = new ColorTransform( 1,1,1,1, 0, 0, 0, -2);
        private function drawline(e:Event):void
        {
            //ちょっとづつ暗くする
            bmpd.colorTransform( bmpd.rect, colorTransform );
            bmpd.draw(container);
            
            //くるくるさせる
            rd= Math.PI/180 * angle;
            radius = 1//Math.sin(rd)*;
            dot.x += Math.cos(rd) * radius + 1;
          //  dot.y+=radius*Math.sin(rd)+1;
            dot.rotation = angle;
            //dot.x +=70;
            //dot.y -=50;
            angle += 3  + Math.random();
            // はみ出たら位置を戻してループさせる
            var left:int = -200, top:int = -200;
            var right:int = stage.stageWidth+200, 
            bottom:int = stage.stageHeight+200;
            if( dot.x < left ) dot.x = right;
            else if( dot.x > right ) dot.x = left;
            if( dot.y < top ) dot.y = bottom;
            if( dot.y > bottom ) dot.y = top;
            
            //bmpd.applyFilter( bmpd, bmpd.rect, new Point, blur );

            //Tweener.addTween(dot, {scaleX:2, scaleY:2, x:stage.stageWidth+100, y:stage.stageHeight+100, time:30, transition:"easeOutSine"});
       }  
    }
}