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

chocolate★disco

これに近い何かを作ってみるテスト
* http://www.youtube.com/watch?v=Hw6Arb387cI
Get Adobe Flash player
by ahchang 03 Jun 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..
/**
* これに近い何かを作ってみるテスト
* http://www.youtube.com/watch?v=Hw6Arb387cI
**/
package
{    
    import flash.display.*;
    import flash.events.*;
    import flash.geom.*;    
    import flash.text.TextField;
    import flash.text.TextFieldAutoSize;
    import flash.text.TextFormat;
    import flash.filters.BlurFilter;
    import caurina.transitions.Tweener;
    import caurina.transitions.properties.ColorShortcuts;

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

    public class disco extends Sprite
    {
        private var container:Sprite;
        private var bmpd:BitmapData;
        private var txt:TextField;
        private var dot:Sprite;
        private var angle:int;
        
        public function disco()
        {
            init();            
            addEventListener(Event.ENTER_FRAME, draw);
        }
        
        private function init():void
        {
            bmpd = new BitmapData(stage.stageWidth, stage.stageHeight, false, 0x000000);
            container = new Sprite();
            addChild(new Bitmap(bmpd));
            
            txt = new TextField();
            txt.defaultTextFormat = new TextFormat('Helvetica', 30, 0xff0000, true);
            txt.autoSize = TextFieldAutoSize.LEFT;
            txt.text = 'チョコレイト・ディスコ';
            container.addChild(txt);
            txt.filters = [blur];
            
            dot = new Sprite();
            container.addChild(dot);
            with(dot.graphics)
            {            
                beginFill(0xffffff);
                drawCircle(0,0,3);
                endFill();
                beginFill(0xffffff);
                drawCircle(80,0,3);
                endFill();
                beginFill(0xffffff);
                drawCircle(160,0,3);
                endFill();
                beginFill(0xffffff);
                drawCircle(240,0,3);
                endFill();
                beginFill(0xffffff);
                drawCircle(320,0,3);
                endFill();
            }
            dot.filters = [blur];            
        }
        
        private var blur:BlurFilter=new BlurFilter(3, 3);
        private var colorTransform:ColorTransform = new ColorTransform( 1, 1, 1, 1, -7, -6, -4);
        private function draw(e:Event):void        
        {
            //ちょっとづつ暗くする
            bmpd.colorTransform(bmpd.rect, colorTransform);
            bmpd.draw(container);
            
            txt.x += 50;
            txt.y -= 40;
            
            dot.x +=70;
            dot.y -=50;
              
            // はみ出たら位置を戻してループさせる
            var left:int = -500, top:int = -50;
            var right:int = stage.stageWidth+50, bottom:int = stage.stageHeight+ 50;
            //txt
            if( txt.x < left ) txt.x = right;
            else if( txt.x > right ) txt.x = left;
            if( txt.y < top ) txt.y = bottom;
            if( txt.y > bottom ) txt.y = top;
            //dot
            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;
            
            ColorShortcuts.init();
            Tweener.addTween(txt,{_hue:240,time:2});
        }  
    }
}