ParallelLife
// forked from psyark's forked from: convolution_life
package {
import flash.display.*;
import flash.events.Event;
import flash.filters.ConvolutionFilter;
[SWF(width=465,height=465,frameRate=120,backgroundColor=0x000000)]
public class ParallelLife extends Sprite {
public function ParallelLife() {
var field:BitmapData = new BitmapData(465, 465, false, 0);
var step:ConvolutionFilter = new ConvolutionFilter(3, 3, [1, 1, 1, 1, 9, 1, 1, 1, 1], 0xFF, 0);
var ruleR:Array = [0, 0, 0, 0xFF0000, 0, 0, 0, 0, 0, 0, 0, 0xFF0000, 0xFF0000];
var ruleG:Array = [0, 0, 0, 0x00FF00, 0, 0, 0, 0, 0, 0, 0, 0x00FF00, 0x00FF00];
var ruleB:Array = [0, 0, 0, 0x0000FF, 0, 0, 0, 0, 0, 0, 0, 0x0000FF, 0x0000FF];
field.noise(Math.random() * 0x100, 0, 255, 7);
addChild(new Bitmap(field));
addEventListener(Event.ENTER_FRAME, function (event:Event):void {
field.applyFilter(field, field.rect, field.rect.topLeft, step);
field.paletteMap(field, field.rect, field.rect.topLeft, ruleR, ruleG, ruleB, null);
});
}
}
}