MEDA102: Computer Coding Exercise

I wanted to make use of the variation and iteration values in a simple, visual way with my dynamic program. Having previously taken part in a group task of recreating an exercise similar to the drawings Sol LeWitt described himself, and it resulting in interpretations and visuals different from the instructions and each other’s end results, I thought it interesting to create a very similar idea (with only straight lines running vertically/horizontally/any angle between as long as the line is straight) in software environment, it would be a fun exercise and help me understand the syntax of the ‘Processing’ language.

Making heavy use of Matt help get me off the ground, I found myself with a structure of ‘for loops’, arrays, translate and rotate functions that allowed me to realise what I’d been aiming to when I set out to undertake the task. I researched other functions such as ‘drawCount’, use of ‘Matrix’ calls, and ‘mouseClicked’ to name a few, but found them unnecessary and bloating.

Each frame of the program drawn results in a, randomly coloured, random number of parallel lines. While this doesn’t sound much like iteration or variation; there’s set parameters that ensure it doesn’t appear too random and does look cohesive and often appealing. Set coordinates for drawing, width and breadth remain similar if not the same. Screenshots and raw code below:

:processing sketch screenshot

screenshot 2

Raw code:

void setup(){

size(1872,860); // defining program window’s resolution
background(255); //defining colour of window background (255 = white)
frameRate(0.91); //no. frames drawn per second


void draw(){



void lineLoop () {

stroke((int)random(255), (int)random(255), (int)random(255),(int)random(200)); // ensures a random colour is chosen each frame, but is never fully opaque
int Iters = (int)random(6,78); // Chooses between 6 and 78 the no. of lines in each set of drawn frame
int progression = width/Iters; // how much space divided by no. of lines; width between the lines in a drawn set
int angleArray [] = {0,45,90,180,300}; // selection of different degree angles selectable in array by next line
int angle = angleArray[(int)random(angleArray.length)]; // summons a value from the array to draw the lines at the selected degree angle

translate(width/2, height/2); // centres drawing to 0,0 coordinates, ensuring every set originates there
rotate(radians(angle)); //converts from angle to radian value for program to plot
for (int x=0; x < Iters; x++){ //enables an infinte looping, utilising the ‘int Iters’ line to repeat the drawing process

line(x*progression,-height/2-400, x*progression,height+height/247); // identifies where (x,y) to begin drawing the sets of lines




Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s