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

メタボール

Get Adobe Flash player
by kuma360 05 Jul 2010
/**
 * Copyright kuma360 ( http://wonderfl.net/user/kuma360 )
 * MIT License ( http://www.opensource.org/licenses/mit-license.php )
 * Downloaded from: http://wonderfl.net/c/eEEu
 */

package {
    
    import flash.display.Bitmap;
    import flash.display.BitmapData;
    import flash.display.GradientType;
    import flash.display.Graphics;
    import flash.display.Sprite;
    import flash.events.Event;
    import flash.filters.GlowFilter;
    import flash.geom.Matrix;
    import flash.geom.Point;
    
    [SWF(backgroundColor="#000000", width="465", height="465", frameRate="30")]
    public class Main extends Sprite {
        
        ////////////////////////////////////////////
        public function Main ( ) {
            
            var A:Array = new Array() ;
            var B:BitmapData = new BitmapData ( 465 , 465 , true , 0 ) ;
            var C:Bitmap = new Bitmap ( B ) ;
            var D:Number = 0 ;
            
            this.addChild ( C ) ;
            
            this.filters = [ new GlowFilter ( 0xFFFF00 ) ] ;
            
            for ( var I:Number = 0 ; I < 256 ; ++ I ) {
                A.push ( I < 150 ? 0 : 0xFF000000 ) ;
            }
            
            this.addEventListener ( Event.ENTER_FRAME , function ( ) :void {
                
                D += 0.04 ;
                
                B.fillRect ( B.rect , 0x000000 ) ;
                B.draw ( circle ( Math.cos ( D ) * 150 + 100 ) ) ;
                B.draw ( circle ( Math.sin ( D ) * 150 + 100 ) ) ;
                
                B.paletteMap ( B , B.rect , new Point ( 0, 0 ) , null, null, null, A ) ;
            
            } ) ;
            
        }
        
        ////////////////////////////////////////////
        public function circle ( x:Number ) :Sprite {
            
            var R:Number = 200 ;
            var Y:Number = 120 ;
            
            var M:Matrix = new Matrix ( ) ;
            M.createGradientBox ( R , R , 0 , x , Y ) ;
            
            var S:Sprite = new Sprite ( ) ;
            var G:Graphics = S.graphics ;
            G.beginGradientFill ( GradientType.RADIAL , [ 0xFFFFFF , 0xFFFFFF , 0xFFFFFF ] , [ 1 , 1 , 0 ] , [ 0 , 10 , 255 ] , M ) ;
            G.drawRect ( x , Y , R , R ) ;
            G.endFill ( ) ;
            
            return S ;
            
        }
        
    }

}