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

湧き出るIncubator(60FPS)

こんなの絶対怖いよ
※Molehillとは一切関係ありません
// forked from Susisu's 湧き出るいくら(60FPS)
// forked from Susisu's 湧き出るいくら
// forked from Susisu's flash on 2011-3-5
package {
    import flash.filters.GlowFilter;
    import flash.geom.Point;
    import flash.display.Shape;
    import flash.geom.Rectangle;
    import flash.events.Event;
    import flash.display.Bitmap;
    import flash.display.BitmapData;
    import flash.display.Sprite;
    import flash.text.TextField;
    //import net.hires.debug.Stats;
    [SWF(frameRate="60")]
    public class FlashTest extends Sprite {
        private var first:Particle;
        private var canvas:BitmapData;
        private var bmp:Bitmap;
        private var rect:Rectangle;
        private var circle:BitmapData;
        private var crect:Rectangle;
        private const point0:Point=new Point(0,0);
        public function FlashTest() {
            canvas=new BitmapData(465,465,true,0);
            rect=canvas.rect;
            bmp=new Bitmap(canvas);
            //addChild(bmp);
            var s:Shape=new Shape();
            s.graphics.beginFill(0xff0060);
            s.graphics.drawCircle(8,8,8);
            s.graphics.endFill();
            s.graphics.beginFill(0xc00000);
            s.graphics.drawCircle(8,8,5);
            s.graphics.endFill();
            s.graphics.beginFill(0xffffff);
            s.graphics.drawCircle(10,4,2);
            s.graphics.endFill();
            var s1:Shape=new Shape();
            s1.graphics.copyFrom(s.graphics);
            s1.width=s1.height=100;
            s1.x=20;
            s1.y=80;
            addChild(s1);
            var s2:Shape=new Shape();
            s2.graphics.copyFrom(s.graphics);
            s2.width=s2.height=100;
            s2.x=345;
            s2.y=80;
            addChild(s2);
            graphics.lineStyle(2,0,1);
            graphics.moveTo(180,300);
            graphics.curveTo(200,330,233,305);
            graphics.moveTo(285,300);
            graphics.curveTo(265,330,233,305);
            var tf:TextField=new TextField();
            tf.width=465;
            tf.height=40;
            tf.htmlText="<p align='center'><font size='28'>僕と契約して閃光少女になってよ!</font></p>";
            
            addChild(bmp);
            var gf:GlowFilter=new GlowFilter(0xffffff);
            tf.filters=[gf];
            addChild(tf);
            circle=new BitmapData(16,16,true,0);
            circle.draw(s);
            crect=circle.rect;
            var r:Number=Math.random()*2*Math.PI;
            first=new Particle(Math.random()*465>>0,Math.random()*465>>0,Math.cos(r),Math.sin(r));
            var prev:Particle=first;
            for(var i:int=0;i<300;i++){
                r=Math.random()*2*Math.PI;
                var next:Particle=new Particle(Math.random()*465>>0,Math.random()*465>>0,Math.cos(r),Math.sin(r));
                prev.next=next;
                prev=next;
            }
            addEventListener(Event.ENTER_FRAME,enterFrame);
            //addChild(new Stats());
        }
        private function enterFrame(e:Event):void{
            canvas.lock();
            canvas.fillRect(rect,0);
            var p:Particle=first;
            var point:Point=new Point(0,0);
            while(p){
                var x:Number=p.x+=p.vx;
                var y:Number=p.y+=p.vy;
                if(x<0){
                    p.x=0;
                    p.vx=-p.vx*0.2;
                }
                else if(x>465-16){
                    p.x=465-16;
                    p.vx=-p.vx*0.2;
                }
                if(y<0){
                    p.y=0;
                    p.vy=-p.vy*0.2;
                }
                else if(y>465-16){
                    p.y=465-16;
                    p.vy=-p.vy*0.2;
                }
                var q:Particle=first;
                while(q){
                    var dx:Number=x-q.x;
                    var dy:Number=y-q.y;
                    var d:Number=dx*dx+dy*dy;
                    
                    if(p!=q&&d<256){
                        p.vx=dx*0.2;
                        p.vy=dy*0.2;
                        q.vx=-dx*0.2;
                        q.vy=-dy*0.2;
                    }
                    q=q.next;
                }
                p.vx*=0.9;
                p.vy*=0.9;
                if(x>200&&x<265)p.vy-=0.98
                else p.vy+=0.98
                //canvas.setPixel32(p.x>>0,p.y>>0,0xff000000);
                point.x=p.x;
                point.y=p.y;
                canvas.copyPixels(circle,crect,point,circle,point0,true);
                p=p.next;
            }
            canvas.unlock();
        }

    }
}
class Particle{
    public var x:Number,y:Number,vx:Number,vy:Number,next:Particle;
    public function Particle(x:Number,y:Number,vx:Number,vy:Number){
        this.x=x;
        this.y=y;
        this.vx=vx;
        this.vy=vy;
        next=null
    }
}