Musings on art, code and life.

Generative Art

AS3 Generative Art Framework

I find myself spending more and more time with ActionScript lately. My first introduction to the Flash platform was through the timeline and some basic AS2, in fact, AS2 was what sparked my interest in scripting. This interest in scripting soon snowballed into a programming interest. Over time, this programming interest exploded into a deep love and appreciation for code of all types.

For me, programming is about building tools to solve problems. I am beginning to understand why I like word problems so much in math class, it is the excitement of solving actual problems with understandable variables. I have never been one to learn from theory. It is too hard to wrap my head around something unless I can see it in action, or at least consider it in a real world situation. Programming is about solving real world problems it is a medium where theory gets twisted into action.

I had a problem. My problem was that I continue to use AS3 to create generative art experiments. This is an issue because of the amount of code needed to get a generative art project up and running. To solve this problem I have created the base for what will become a generative art framework.

genartclass

The GenArt class should be used as a base for any new generative art project. By using GenArt, your project will have access to the GenArt API that will provide a drawing surface, methods to animate the drawing (or not!) and a method to save a file to the desktop.

To facilitate the saving of a completed image, the AS3 Core Library was used. You can find that library at http://code.google.com/p/as3corelib/.

Please note, this is an Adobe AIR project as it needs access to the file system to save the completed artwork. Artwork is saved to the desktop, it is named snapshot.png.


Form & Space Generative Art

Control Point Decline ↓

ControlPointDecline

Sine Wave Ocean ↓

SineWaveOcean

These two compositions are explorations of  a single concept. For these pictures, I was exploring drawing multiple lines with a changing control point. The “Control Point Decline” project was the beginning of the line exploration. The concept was simple; what would a design look like if we drew many, many lines, beginning and ending in the same place but modifying the control point with each iteration. The first acceptable generation I achieved involved a very precise structure with little “personality”. The evolution of that piece generated some very interesting deconstructions of the dome structure. The final stage of the piece distorted the control point so greatly that the lines begin to define the frame of the canvas. Two iterations of the final stage are displayed side by side and much larger than the dome structures.

The “Sine Wave Ocean” project was a variation of the “Control Point Decline” project. With this variation, I select random points for the beginning and end of the lines but the control points are distributed based on simple algebra equations. The image shown here is a composition of multiple iterations of the “Sine Wave Ocean” code.

Recursive Triangle Construction ↓

TriangleRecursion

The above piece, “Recursive Triangle Construction”, has generated some truly interesting visuals. The concept for this was simple. I wanted to see what a composition would look like if we created triangles stacked with each new shape smaller than it’s preceding shape. Each new shape would also be rotated slightly. In the larger image on the left, I added a random variable in the placement and achieved this interesting shape. The three small structures on the right explore the de-evolution of the structured shape.

These artworks are created in Adobe Flash using the ActionScript 3.0 language specification. I have included the code necessary to recreate the larger triangle image. To set up this project; create a new Flash As3 project and set the document class to RecursiveTriangleConstruction. Save that file somewhere and then create a new Actionscript file. Copy the sample code into the Actionscript file and then save it next to the project file, name it “RecursiveTriangleConstruction.as”.

Compile and enjoy! Click on the stage to generate a new iteration.