Archive for the ‘Art’ Category
ActionScript 3.0: creating random art using simple vector shapes, part 2
having written this post on how to create random art in ActionScript using simple shapes and read it a few times, I realized that I hadn’t made a version that was in fullscreen mode. so here’s the last example in the previous post remade in fullscreen.
check out this link to see the random vector shape art created in ActionScript in fullscreen!
ActionScript 3.0: creating random art using simple vector shapes
having read this article by Bruno Crociquia, I had to try it out for myself.
so I created some very random vector shapes in Flash, among others, these:

all I had to do from here, was to add a few changes to Bruno’s original code to make it fit my wishes, and then publish my Flash.
click the picture below to see how my Flash ended up:
if you click the flash movie and then press any key the Flash will randomly recreate art!
well, so far so good, Bruno’s task completed..
..but I wanted to see what would happen, if I made the Flash recreate itself constantly.
so I used a Timer, and made the Flash create new art 5 times pr. second.
check out the rather hypnotising Flash art here:
ok, so far so good, but what if I decrease the amout of alpha of each shape from 0.9+ to only 0.4?
actually this creates a quite different effect.
check out the rather hypnotising semitransparent Flash art here:
last, I experimented with a more relaxed flow, I decided to bring one random shape to the stage at a time.
this ended up in this neverending mosaic art, still using those very same vectors.
check out this last experiment on trying to create Flash art here:
the Document Class ActionScript for the last example can be copied from here:
import caurina.transitions.Tweener;
import flash.display.GradientType;
import flash.display.Graphics;
import flash.display.SpreadMethod;
import flash.display.Sprite;
import flash.events.Event;
import flash.events.KeyboardEvent;
import flash.events.TimerEvent;
import flash.geom.ColorTransform;
import flash.geom.Matrix;
import flash.utils.Timer;
import MonsterDebugger;
public class RandomFlashArtContent extends Sprite {
private var _md:MonsterDebugger;
private var maxscale:Number = 1.2; // this is the maximum scale value that our shapes will be allowed to achieve
private var minscale:Number = 1; // this is the minimum scale value that our shapes will be allowed to achieve
private var maxrotation:Number = 180; // maximum rotation value for our shapes
private var offsetX:Number = 100; // the offset is the value that will trigger the discrepancy of your composition
private var offsetY:Number = 100; //
private var marginX:Number = 100; // this is the margin for the x axis
private var marginY:Number = 100; // this is the margin for the y axix
private var colorPalete:Array = [0xFFE6C9,0x960F66,0xF55E54,0xCC2C57,0x171F21]; //Bending Color For the BLind
private var _timer:Timer;
//background gradient settings;
var type:String = GradientType.LINEAR;
var colors:Array = [ 0x000000, 0x000000];
var alphas:Array = [ 1, 1 ];
var ratios:Array = [ 0, 255 ];
var matr:Matrix = new Matrix();
var sprMethod:String = SpreadMethod.PAD;
var bg:Sprite = new Sprite();
var g:Graphics = bg.graphics;
public function RandomFlashArtContent() {
init();
}
private function init():void {
trace("function init");
_md = new MonsterDebugger(this);
_timer = new Timer(90, 0);
_timer.addEventListener(TimerEvent.TIMER, goCreate, false, 0, true);
_timer.start();
createBackground();
}
private function createBackground(){
//starts a gradient box
matr.createGradientBox(800, 550, 90, 0, 0 ); //make the gradient the size of your stage, set the rotation to 90 degrees
//begins the fill
g.beginGradientFill(type, colors, alphas, ratios, matr, sprMethod );
//draws the rectangle
g.drawRect( 0, 0, 800, 550 ); //be sure to draw the rectangle the size of your stage
addChild(bg);
createComposite();
}
function removeComposite(){
while(numChildren > 0){
//eliminates all of the child objects from the main timeline
removeChildAt(0);
}
}
private function goCreate(e:TimerEvent):void{
createComposite();
}
private function createComposite(){
var obj:RandomObject=new RandomObject();
//what shape to show
obj.gotoAndStop(Math.round(Math.random()*obj.totalFrames));
//set the objects position
obj.x = Math.random() * 700 + 50; //marginX;
obj.y = Math.random() * 450 + 50; //+ marginY;
//sets the scale
obj.scaleX = obj.scaleY = Math.random()*maxscale+minscale;
//sets the rotation
obj.rotation = Math.random()*maxrotation;
//sets a random color from the palette
var c:ColorTransform = new ColorTransform(); // we create an auxiliary color transform object that will carry a random color from the palette
c.color = colorPalete[Math.ceil(Math.random()*colorPalete.length)-1]; // the minus 1 is basically because an array starts at index 0
obj.transform.colorTransform = c; //we apply the color to the object color transformation
//sets an alpha
obj.alpha = 0;
var theTime:Number = Math.random()*15;
var theDelay:Number = Math.random()*15;
var theAlpha:Number = Math.random();
Tweener.addTween(obj, {alpha:theAlpha, time:theTime});
Tweener.addTween(obj, {alpha:0, time:theTime, delay:theDelay});
//adds to stage
addChild(obj);
}
}
}
the color theme for these pieces of art is found at Kuler, and is called “Bending Color For The Blind”.
