ABC
/**
* Copyright gupon ( http://wonderfl.net/user/gupon )
* MIT License ( http://www.opensource.org/licenses/mit-license.php )
* Downloaded from: http://wonderfl.net/c/q8Or
*/
package {
import flash.display.Bitmap;
import flash.display.BitmapData;
import flash.display.Sprite;
import flash.events.Event;
import flash.events.TimerEvent;
import flash.filters.BitmapFilter;
import flash.filters.ConvolutionFilter;
import flash.geom.Matrix;
import flash.geom.Point;
import flash.geom.Rectangle;
[SWF(width=465,height=465,frameRate=60)]
import flash.utils.Timer;
public class Test extends Sprite {
public function Test() {
function hoge():void {
A ( B ( C (
A ( B ( C (
A ( B ( C (
A ( B ( C (
A ( B ( C (
A ( B ( C (
A ( B ( C (
A ( B ( C (
A ( B ( C (
A ( B ( C (
A ( B ( C (
A ( B ( C (
Bitmap(addChild(new Bitmap(
new BitmapData(465, 465))))
) ) )
) ) )
) ) )
) ) )
) ) )
) ) )
) ) )
) ) )
) ) )
) ) )
) ) )
) ) )
}
var timer:Timer = new Timer( 1000 );
timer.addEventListener( TimerEvent.TIMER, function(event:Event):void {
if( numChildren ) {
var src:Bitmap = Bitmap(getChildAt(0));
src.bitmapData.dispose();
removeChild(src);
}
hoge();
});
timer.start();
}
public function A( b:BitmapData ):Bitmap {
const w:int = 30 + Math.floor( Math.random() * 100 );
const h:int = 30 + Math.floor( Math.random() * 100 );
const row:int = Math.floor( 465 / w );
const col:int = Math.floor( 465 / h );
const n:int = row * col;
for ( var i:int=0;i<n;i++ ) {
b.copyPixels( b, new Rectangle( 0, 0, w, h ), new Point( i % row * w, h * Math.floor( i / col )));
}
return Bitmap(getChildAt(0)); //ここが残念
}
public function B(c:BitmapData):BitmapData {
const matrix:Array = [
1, -1, -1, -1, 1,
-1, 1, -1, -1, 1,
-1, -1, 1, -1, 1,
-1, -1, -1, 1, 1,
1, 1, 1, 1, 1,
];
var divisor:int = 0;
for each ( var n:int in matrix ) divisor += n;
const filter:BitmapFilter = new ConvolutionFilter( 5, 5, matrix, divisor, 0, true, true, 0, 0 );
c.applyFilter( c, new Rectangle( 0, 0, c.width, c.height ), new Point( 0, 0 ), filter );
var m:Matrix = new Matrix();
m.rotate(Math.random());
c.draw( c, m );
return c;
}
public function C( a:Bitmap ):BitmapData {
const src:BitmapData = a.bitmapData;
src.setPixel( 1, 1, Math.random() * 0xFFFFFF );
return src;
}
}
}