forked from: forked from: convolution_life
// forked from hacker_3szp8277's forked from: convolution_life
package {
import flash.display.Bitmap;
import flash.display.BitmapData;
import flash.display.BitmapDataChannel;
import flash.display.Sprite;
import flash.events.Event;
import flash.filters.ConvolutionFilter;
import flash.geom.Point;
public class convolutionLife6 extends Sprite
{
private var life:BitmapData;
private var step:ConvolutionFilter;
private var rule:Array;
public function convolutionLife6()
{
life = new BitmapData(465, 465, false, 0);
var t:Date = new Date();
life.noise(t.milliseconds,0,1,BitmapDataChannel.BLUE);
var col:Array = [0,0xff];
life.paletteMap(life, life.rect, pt, null,null , col, null);
addChild(new Bitmap(life));
step = new ConvolutionFilter(3, 3, [1, 1, 1,
1, 9, 1,
1, 1, 1], 0xff, 0);
rule = [3, 1, 0, 0x31FF,
4, 1, 0, 0,
6, 1, 0, 0x00FF, 0x00FF];//13
addEventListener(Event.ENTER_FRAME,onEnterFrame);
}
private const pt:Point = new Point();
private function onEnterFrame(e:Event) :void{
life.applyFilter(life, life.rect, pt, step);
life.paletteMap(life, life.rect, pt, null,null , rule, null);
}
}
}