Light Horns Sketch
September 17th, 2008This sketch is a few months old. It's made up of ten horn-like formations that appear to glow:
Click any of the above images to see the flash version
To achieve something that at times looks like its being altered by light I use a technique that I originally stumbled upon in photoshop.
1) Take your abstract image that looks 2D or Flat
2) Duplicate it
3) Blur it
4) Place it over your original image with an offset and a blend mode / layer mode
Here is a simpler example of this technique:
move mouse around white blur, click to cycle through different blendmodes
Here's the code - you can copy and paste it to your flash timeline:
-
stage.frameRate = 31;
-
var original:BitmapData = new BitmapData(400,400, true, 0xFF000000);
-
var circle:Shape = new Shape();
-
circle.graphics.beginFill(0xdddddd);
-
circle.graphics.drawCircle(200,200,100);
-
original.draw(circle);
-
original.applyFilter(original, original.rect, new Point(0,0), new BlurFilter(10,10,2));
-
var overlay:BitmapData = new BitmapData(400,400, true, 0xFF000000);
-
overlay.applyFilter(original, original.rect, new Point(0,0), new BlurFilter(20,20,2));
-
-
-
var canvas:BitmapData = new BitmapData(400,400, true, 0xFF000000);
-
addChild(new Bitmap(canvas));
-
-
var m:Matrix = new Matrix();
-
-
addEventListener(Event.ENTER_FRAME, onLoop);
-
-
var modeIndex:int = 0;
-
var modes:Array =[BlendMode.HARDLIGHT,
-
BlendMode.OVERLAY,
-
BlendMode.DARKEN,
-
BlendMode.DIFFERENCE,
-
BlendMode.SUBTRACT,
-
BlendMode.ADD,
-
BlendMode.MULTIPLY];
-
-
function onLoop(evt:Event):void {
-
canvas.copyPixels(original, original.rect, new Point(0,0), null, null, true);
-
m.tx = Math.max(-33,Math.min(33,(mouseX-200) / 6));
-
m.ty = Math.max(-33,Math.min(33,(mouseY-200) / 6));
-
canvas.draw(overlay, m, null, modes[modeIndex % modes.length]);
-
}
-
-
stage.addEventListener(MouseEvent.MOUSE_DOWN, onChangeMode);
-
function onChangeMode(evt:MouseEvent):void {
-
modeIndex++;
-
trace(modes[modeIndex % modes.length]);
-
}
This sketch would actuallty be a good candidate to test out my fast drawing library. I think I can create the same thing with many more horns. The number of horns is currently limited by the fact that each is made up of lots of circle movieClips.