I have just spent the last day or so polishing up on my generative art in flash. This basically means creating random motion using TweenLite or/and Away3d.
Here are some sceen shots of what I am talking about:
(Just click on the images to view them
)
These were made using a combination of TweenLite, Away3D and general brilliance
. The first one actually uses no 3d, and I made the second one to see how easily it would be the get the same (or close to) result, but in 3D space.
Here is the code for the first one, just past it in the first frame.
import gs.TweenFilterLite;
import gs.easing.Expo;
var Blur:BlurFilter = new BlurFilter(100, 100, 3);
var BMBlur:BlurFilter = new BlurFilter(20, 20, 3);
var bmd:BitmapData = new BitmapData(550, 400, true, 0x000000);
var bm:Bitmap = new Bitmap(bmd);
addChild(bm);
var currentSquare:Box = new Box();
currentSquare.filters = [Blur];
addChild(currentSquare);
function mover_single():void {
TweenFilterLite.to(currentSquare, .5, { x:Math.random() * 550,
y:Math.random() * 400,
ease:Expo.easeInOut,
alpha:100/*Math.random() * 1*/,
blurFilter:{blurX:Math.random() * 0,
blurY:Math.random() * 50},
tint:Math.round( Math.random()*0xFFFFFF ),
onComplete:mover_single });
}
mover_single();
addEventListener(Event.ENTER_FRAME, EnterFrame);
function EnterFrame(evt:Event):void {
bmd.draw(this);
bmd.applyFilter(bmd, bmd.rect, new Point(0, 0), BMBlur);
bmd.scroll(5, 0);
//trace(getChildAt(1));
}
And the second:
package {
import away3d.containers.Scene3D;
import away3d.containers.View3D;
import away3d.primitives.Cube;
import flash.display.Bitmap;
import flash.display.BitmapData;
import flash.display.MovieClip;
import flash.events.Event;
import flash.filters.BlurFilter;
import flash.geom.Point;
import gs.TweenLite;
import gs.easing.Expo;
public class Organic extends MovieClip {
public var scene:Scene3D = new Scene3D;
public var view:View3D = new View3D( { scene:scene, x:0, y:0 } );
public var square:Cube;
public var bmd:BitmapData = new BitmapData(stage.stageWidth, stage.stageHeight, true, 0x000000);
public var bm:Bitmap = new Bitmap(bmd);
public var BMBlur:BlurFilter = new BlurFilter(10, 0, 3);
public var Blur:BlurFilter = new BlurFilter(5, 5, 3);
public function Organic():void {
addEventListener(Event.ADDED_TO_STAGE, Init);
addEventListener(Event.ENTER_FRAME, EnterFrame);
}
private function Init(evt:Event):void {
addChild(view);
addChild(bm);
view.camera.zoom = 1.5;
square = new Cube( { height:200, width:200, material:"red#black" } );
square.filters = [Blur];
view.scene.addChild(square);
Mover(); // This animates the box and then renders it/
}
private function Mover():void {
TweenLite.to(square, .5, { x:Math.random() * -5550,
y:Math.random() * -5400,
z:Math.random() * 200,
ease:Expo.easeInOut,
onComplete:Mover,
alpha:Math.random() * 1,
rotationX:Math.random() * 360,
rotationY:Math.random() * 360,
height: Math.random() * 1000,
width: Math.random() * 1000 } );
view.render();
}
private function EnterFrame(evt:Event):void {
bmd.draw(this);
bmd.applyFilter(bmd, bmd.rect, new Point(0, 0), BMBlur);
bmd.scroll(5, 0);
view.render();
}
}
}
So there you go. Here are the links to download the whole package:
- The First one: http://harry-northover-code-store.googlecode.com/files/Random%20Squares.zip
- The Second one: http://harry-northover-code-store.googlecode.com/files/3D%20Organic.zip
Harry.

