Burning Bush
Per request from m. allen west :)
@author naoto.koshikawa, treeのアレ
@author makc, naoto code fork and spiral on fire
package
{
import flash.display.*;
import flash.geom.*;
import flash.filters.*;
[SWF(width = "464", height = "465", backgroundColor = "0x000000", frameRate = "20")]
/**
* Per request from m. allen west :)
* @author naoto.koshikawa, treeのアレ
* @author makc, naoto code fork and spiral on fire
*/
public class Main4 extends Sprite
{
private const H:Number = 465, W:Number = 465;
private const SY:Number = 2.0001 / H, SX:Number = 2.0001 / W, DY:Number = -15, DX:Number = DY;
private const FadeOut:ColorTransform = new ColorTransform(1, 1, 1, 1, -1, -6, -9, 0);
private const MixPixels:BlurFilter = new BlurFilter(2, 2, 2);
private const CopyMatrix:Matrix = new Matrix (1, 0, 0, 1, 0, 0);
private const CopyRatios:ColorTransform = new ColorTransform(1, 1, 1, 1, 0, 0, 0, 0);
private const Origin:Point = new Point (0, 0);
private const ScaleMatrix:Matrix = new Matrix(1 - SX * DX, 0, 0, 1 - SY * DY, DX,
/* quick hack to move zoom center */ 1.6 * DY);
private var b1:BitmapData = new BitmapData (W, H, true, 0);
private var b2:BitmapData = new BitmapData (W, H, true, 0);
private var _radianLt:Number;
private var _radianRt:Number;
public function Main4()
{
addChild (new Bitmap (b1));
addEventListener("enterFrame", enterFrameListener);
}
private function draw(start:Point, radian:Number, radius:Number):void
{
if (radius < 3) return;
var gr:Graphics = graphics;
gr.lineStyle(1, 0x10101 * int(Math.random() * 200));
gr.moveTo(start.x, start.y);
var end:Point = new Point(start.x + Math.cos(radian) * radius,
start.y + Math.sin(radian) * radius);
gr.lineTo(end.x, end.y);
gr.endFill();
draw(end, radian + _radianLt, radius * 0.66);
draw(end, radian - _radianRt, radius * 0.66);
}
private function enterFrameListener(e:*):void
{
var radian:Number = (1- (mouseY / stage.stageHeight)) * (Math.PI / 2) - Math.PI / 2;
var twist:Number = (mouseX - stage.stageWidth / 2) / stage.stageWidth; // -0.5..+0.5
_radianLt = (1 - twist) * radian;
_radianRt = (1 + twist) * radian;
graphics.clear();
draw(new Point(465/2, 465), -Math.PI/2, 75);
// here goes my flamy crap again
b1.draw(this, CopyMatrix, CopyRatios, "normal", b1.rect);
b2.applyFilter(b1, b1.rect, Origin, MixPixels);
b1.draw(b2, ScaleMatrix, FadeOut, "normal", b1.rect);
}
}
}