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

Composition[WIP]

いい感じにならないかとかおもったけど微妙
RGBであること自体がだめそう
Get Adobe Flash player
by phi16 12 May 2015
    Embed
/**
 * Copyright phi16 ( http://wonderfl.net/user/phi16 )
 * MIT License ( http://www.opensource.org/licenses/mit-license.php )
 * Downloaded from: http://wonderfl.net/c/tydG
 */

package {
    import flash.display.Sprite;
    import flash.events.*;
    public class F extends Sprite {
        private var bg:Sprite = new Sprite();
        private var spr:Array = [new Sprite(),new Sprite(),new Sprite()];
        private var mot:Sprite = new Sprite();
        private var col:Array = [0xff0000,0x00ff00,0x0000ff];
        private var ent:Array = [[],[],[]];
        private var met:Array = [];
        private var i:int = 0, count:Number = 0, time:int = 0;
        public function F() {
            bg.graphics.beginFill(0);
            bg.graphics.drawRect(0,0,465,465);
            bg.graphics.endFill();
            addChild(bg);
            for(i=0;i<3;i++){
                spr[i].blendMode = "add";
                addChild(spr[i]);
            }
            mot.blendMode="add";
            addChild(mot);
            this.addEventListener(Event.ENTER_FRAME, frame);
        }
        private function clear():void{
            for(i=0;i<3;i++)spr[i].graphics.clear();
        }
        private function drawC(x:Number, y:Number, c:int):void{
            spr[c].graphics.beginFill(col[c]);
            spr[c].graphics.drawCircle(x,y,20);
            spr[c].graphics.endFill();
        }
        private function frame(e:Event):void{
            clear();
            mot.graphics.clear();
            for(i=0;i<3;i++){
                for(var j:int=0;j<ent[i].length;j++){
                    drawC(ent[i][j].x,ent[i][j].y,i);
                    if(ent[i][j].cnt==100){
                        ent[i][j].cnt=0;
                        if(i==0)met.push(ent[i][j]);
                        ent[i].splice(j,1);
                        j--;
                    }else{
                        ent[i][j].x+=ent[i][j].vx;
                        ent[i][j].y+=ent[i][j].vy;
                        ent[i][j].cnt++;
                    }
                }
            }
            for(i=0;i<met.length;i++){
                mot.graphics.beginFill(0xffffff,1-met[i].cnt/5);
                mot.graphics.drawCircle(met[i].x,met[i].y,20+met[i].cnt);
                mot.graphics.endFill();
                met[i].cnt++;
                if(met[i].cnt==5){
                    met.splice(i,1);
                    i--;
                }
            }
            if(time%10==0){
                for(i=0;i<3;i++){
                    var px:Number=465/2.0+Math.cos(count*Math.PI/24)*150;
                    var py:Number=465/2.0+Math.sin(count*Math.PI/24)*150;
                    var vel:Number=6;
                    var dir:Number=(Math.random()*2-1)*Math.PI+count*Math.PI/12;
                    var vx:Number=Math.cos(dir)*vel;
                    var vy:Number=Math.sin(dir)*vel;
                    var fr:Number=100;
                    var c:Circle = new Circle(px-vx*fr,py-vy*fr,vx,vy);
                    ent[i].push(c);
                }
                count++;
            }
            time++;
        }
    }
}

class Circle{
    public var x:Number, y:Number;
    public var vx:Number, vy:Number;
    public var cnt:int;
    public function Circle(x_:Number, y_:Number, vx_:Number, vy_:Number){
        x=x_,y=y_,vx=vx_,vy=vy_;
        cnt=0;
    }
}