color stripes
/**
* Copyright jerryrom ( http://wonderfl.net/user/jerryrom )
* MIT License ( http://www.opensource.org/licenses/mit-license.php )
* Downloaded from: http://wonderfl.net/c/dzSQ
*/
// forked from jerryrom's stripe
package
{
import flash.display.Bitmap;
import flash.display.BitmapData;
import flash.display.Sprite;
import flash.events.Event;
import flash.filters.BlurFilter;
import flash.geom.Matrix;
import flash.geom.Rectangle;
import flash.geom.Point;
import flash.geom.ColorTransform;
public class Main extends Sprite
{
private var bmpdata:BitmapData;
private var matrix:Matrix;
private var circle:Sprite;
private var filter:BlurFilter;
private var rect:Rectangle;
private var colorTransform:ColorTransform;
[SWF(width="465", height="465", framerate="30")]
public function Main():void
{
if (stage) init();
else addEventListener(Event.ADDED_TO_STAGE, init);
}
private function init(e:Event = null):void
{
removeEventListener(Event.ADDED_TO_STAGE, init);
bmpdata = new BitmapData(465, 465, false, 0xFFFFFF);
addChild(new Bitmap(bmpdata, "auto", true));
circle = new Sprite();
circle.graphics.beginFill(0x000000);
circle.graphics.drawCircle(465/2, 0, 10);
circle.graphics.endFill();
matrix = new Matrix();
matrix.identity();
colorTransform = new ColorTransform(0,0,0);
filter = new BlurFilter(2, 2, 1);
addEventListener(Event.ENTER_FRAME, enterframe);
rect = new Rectangle(465/2-5, 0, 20, 465);
}
private function enterframe(e:Event):void
{
var x:Number = (Math.random() - 0.5)*2;
var y:Number = Math.random()*10;
matrix.translate(x, y);
colorTransform.redOffset = Math.random() * 0xff;
colorTransform.greenOffset = Math.random() * 0xff;
colorTransform.blueOffset = Math.random() * 0xff;
bmpdata.draw(circle, matrix, colorTransform);
bmpdata.applyFilter(bmpdata, rect, new Point(Math.random()*465, 0), filter);
}
}
}