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

flash on 2010-12-27

模様に特に意味はない
Get Adobe Flash player
by Susisu 27 Dec 2010
    Embed
package{
    /*
        模様に特に意味はない
    */
    import flash.geom.ColorTransform;
    import flash.display.Sprite;
    import flash.display.BitmapData;
    import flash.display.Bitmap;
    import flash.geom.Rectangle;
    import flash.geom.ColorTransform;
    import flash.events.Event;
    import net.hires.debug.Stats;
    [SWF(width="465", height="465", backgroundColor="0x000000", frameRate="60")]
    public class Dots extends Sprite{
        public var dots:Vector.<Dot>=new Vector.<Dot>();
        public var p:int=0,q:int=0;
        public var _canvas:BitmapData=new BitmapData(465,465,true,0);
        public var bmp:Bitmap=new Bitmap(_canvas);
        public var _canvas2:BitmapData=new BitmapData(465,465,true,0);
        public var bmp2:Bitmap=new Bitmap(_canvas2);
        public var bmprect:Rectangle=new Rectangle(0,0,465,465);
        public var ct:ColorTransform=new ColorTransform(1,1,1,0.8);
        public var f:Boolean=true;
        public const w:int=100,h:int=100;
        public var graph:BitmapData=new BitmapData(w,h,true,0);
        public function Dots(){
            addChild(bmp);
            addChild(bmp2);
            var stats:Stats=new Stats();
            stats.alpha=0.5;
            addChild(stats);
            var spt:Sprite=new Sprite();
            spt.graphics.beginFill(0xffffff);
            spt.graphics.drawRect(0,0,w,h);
            spt.graphics.endFill();
            spt.graphics.beginFill(0x0000ff);
            spt.graphics.drawCircle(w/2,h/2,50);
            spt.graphics.endFill();
            spt.graphics.beginFill(0x008000);
            spt.graphics.drawRect(25,25,50,50);
            spt.graphics.endFill();
            graph.draw(spt);
            addEventListener(Event.ENTER_FRAME,main);
        }
        public function main(e:Event):void{
            _canvas.lock();
            _canvas.colorTransform(bmprect,ct);
            if(f){
            for(var j:int=0;j<24;j++){
                dots.push(new Dot(Math.random()*465,465,p+(465-w)/2,q+(465-h)/2,graph.getPixel32(p,q)));
                if(++p>w){p=0;if(++q>h)f=false;}
            }
            }
            var l:int=dots.length;
            for(var i:int=0;i<l;i++){
                if(dots[i].f++<256){dots[i].x+=dots[i].vx;dots[i].y+=dots[i].vy;
                _canvas.setPixel32(dots[i].x>>0,dots[i].y>>0,dots[i].color);}
                else{_canvas2.setPixel32(dots[i].x>>0,dots[i].y>>0,dots[i].color);dots.splice(i,1);i--;l--;}
            }
            _canvas.unlock();
        }
    }
}
class Dot{
    public var x:Number,y:Number,vx:Number,vy:Number,f:uint=0,color:uint;
    public function Dot(x:Number,y:Number,p:Number,q:Number,color:uint){
        this.x=x;
        this.y=y;
        this.vx=(p-x)/256;
        this.vy=(q-y)/256;
        this.color=color;
    }
}