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: ◯と○

1個目 とりあえず 線を引いてみたい
Get Adobe Flash player
by gurumi 28 May 2009
// 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="60", 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=90;

        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= 0; i<330; i++){
                beginFill(0xFF00FF);
                drawCircle(i,-30,3);
                endFill();
                }
             }            
            
            //フィルタ
            dot.filters = [blur];
        }
        private  var blur:BlurFilter=new BlurFilter(8,8);
        private var colorTransform:ColorTransform = new ColorTransform( 1,1,1, 1, -7, -6,-4);
        private function drawline(e:Event):void
        {
            //ちょっとづつ暗くする
            bmpd.colorTransform( bmpd.rect, colorTransform );
            bmpd.draw(container);
            
            //くるくるさせる
            rd=Math.PI/180*angle;
            radius = Math.sin(rd)*6;
            dot.x+=radius*Math.cos(rd)+3;
            dot.y+=radius*Math.sin(rd)+2;
            dot.rotation = angle;
            //dot.x +=70;
            //dot.y -=50;
            angle+=3;
              
            // はみ出たら位置を戻してループさせる
            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"});
       }  
    }
}