Thursday 26 May 2011

A Variable is a Cloning Machine


Variables are like cloning machines. The value assigned to the ‘int’ or ‘float’ variable is like the shape which you wish to clone. The shape is placed in the left compartment of the machine. The red button is pressed, causing the machine to begin the process of cloning. This is akin to the act of typing the variable into the code after the value has been assigned to the variable. The shape can be cloned as many times as the user desires. Therefore, you can clone the red shape infinite times to create interesting results. 
           
The left compartment stores the initial shape, so that cloning is always possible. This is like the ‘memory’ or ‘storage’ of the variable. In this case, an abstract form will be retrieved from the machine when it is needed. The red shapes act as the medium which construct free-flowing patterns. These are like the numbers which build code. By a press of the button, more shapes can be cloned, just as the same value can be used several times within a code through the use of variables. Without the cloning machine, the shape would have to be manufactured every time the user wanted to add another one to the pattern. Without variables, the same situation occurs. The required code would have to be typed out each time it is necessary. Variables are vital in creating interesting programmes with less lines of code, just as a cloning machine is essential in the building of an interesting form composed of multiple identical shapes.

Thursday 19 May 2011

Time Management and Cost

These are my time management and budget plans for the next weeks:



Refining My Idea

After giving my interim presentation, I settled on the second concept. I have made some alterations to it. I am still going to make it into a short stop motion video, but have rethought the cloning machine. I have changed its appearance, so it is more akin to those seen on TV shows or science-fiction movies.
Kim Possible, Disney Channel
The Human Duplicators, 1965
I drew out a rough storyboard for my clip. 

The hand introduces a narrative into the video, but I am unsure about whether it should remain there or not. I will try it with and without the human interaction. The red circles represent the code that you assign to the variable. I have written out new pseudo code for this specific video:

cloneMachine shape = redCircle; //this is the act of putting the shape into the cloning machine

void draw() {

clone shape = 5; //cloning the shape five times

}

This code describes the setting up of the cloning machine, which is the variable. The red circle is put into it when you type out the code. There is then a clone funciton, which is the retrieving of the variable later in the code. You can determine how many times the variable is used, as it is always stored in the left compartment of the cloning machine. Therefore, you can 'clone' the variable infinite times to create interesting programmes with fewer lines of code. Rather than having to write out every shape that comes out of the cloning machine, you can store other shapes in the left compartment and clone those. In my video, I will only represent the cloning of one variable (the red circle), so that the idea is not over-complicated. It is like using int or float. In this case, the variable that can be stored is a red circle, rather than a whole (int) or decimal number (float).

I have chosen to do a stop motion because it is the most effective way to depict the act of cloning. An interactive installation with this idea would be unsatisfying unless I devised of something that hasn't existed in mankind's history (inventing a cloning machine). I want to exhibit a moving image, and decided a stop motion with a handmade clone machine model is the method which will have a more impressive result.









Monday 16 May 2011

Pseudo Codes

In order to better understand my three ideas, I wrote out some pseudo code. This is the code for the first design:

int a = circle;
int b = square;

void grab(); {

arm a; //arm retrieves the 'a' from the variables at the top (storage)
arm b; (move faster); //dictates the speed the shape moves down the arm

}
The middle section is the programme. The speed and frequency with which the variables are used changes the design in the centre. The arms retrieve the shape indicated by the variable form the outer edges of the posters. The shapes could move through the arms and into the centre.

This is the code for the second idea:

int a = circle;
int b = diamond;

void draw() {

machine a; //being put through the machine
machine b;

}
After writing this code I realised the cloning machine acts as the memory. When you place the first shape in (eg circle) the machine, the machine stores it in its memory. You can then get infinite clones of the shape, depending on how many you wish to use.

This is the code for the third idea:

int diamond = colour1; //variable represents different reaction
int square = colour2;

void setup(){

waterContainer (100, 100);

}

void draw() {

drop diamond; //this specific variable creates unique colour/reaction
drop square;

}
Dropping the shape triggers the reaction in the water. This represents the triggering of the code's memory, so that it retrieves the variable from the top of the code and implements it in the programme.

Sunday 15 May 2011

First Three Ideas

Once I had chosen my term 'variables', I researched them online. I read the Wikipedia article about the coding term, and it was relatively helpful. After reading it I brainstormed what I understand about variables and refined them into metaphors.

I then sketched out each of the ideas. I will write out a cost plan underneath each sketch, and will create a time management plan once I have decided on one of the designs.

Card for the posters - $5
Coloured card - $5
Unsure of what aspects of the design will be moveable and still image. 

Card - $5
Coloured card - $5
I already have a camera and a tripod, so I would just need to construct the 'time machine', which I would hope to do before Friday 20th. I would also hope to have the card shapes created by then. Afterwards it would be a case of taking the photos, which may be too time-consuming to do before the 29th.
Filter paper - $5
Plastic - $4
Dye - $6
I haven't yet decided on what I would use as containers, if the containers of water were to look like this. This idea could be implemented in other ways, such as having no water and colouring the plastic so that the coloured shapes would fill up the container. I would like to have this decided by the 18th, so that I can construct the small shapes by the 20th. I would spend the next week refining the design so that it functions well, and write the description during the middle of the week (24th, 25th, 26th).

Monday 9 May 2011

Analysing Code

For the third project, I have chosen the coding term 'variables'. In this post I will pinpoint the instances in which the programmes make us of variables.

Code One:




In this code, float has been used. This tells us that the numbers used will contain decimals. The beginning of the code looks like this:

float diam; // width of ellipse and weight of line
float dripRan = random(1); //random size of drips
float dripWidth = random(1); //drip width

The function of each variable is given. The size of the drips and the width of them will be a random number. This means that when 'dripRan' and 'dripWidth' are used later in the code, a random number will be retrieved. Thus creating the inconsistency of the final spray can effect. diam is used later in this line:

diam = abs(mouseY - height/2)*.18;

This variable has not been assigned a specific number, which allows the code to 'constantly recalculate diameter as a distance from the mouse to the center, and make it 10% of that'. This creates the variation of sizes of circles, adding to the randomness the other two variables establish. They are implemented like this:

dripRan = random(10, 300);
dripWidth = random(.1, 3);

There are some limits being put down here, to achieve the desired length of drips and width of the 'spray'. The float variables have enabled the code to take up few lines, as there is a randomness stored in them which is used to create the ever-changing design. You can alter the length of the drips easily, as well as the width, because variables allow you to input less code to achieve a significant change.

Code Two:



This code is begun with numerous int variables. These are:

int W = 400; // screen Width (should be evenly divisible by S)
int H = 300; // screen Height (should be evenly divisible by S)
int S = 2; // ca cell Size or Scale in pixels when rendered
int C = W / S; // number of Columns in the ca
int R = H / S; // number of Rows in the ca
int mode=1; // which "variation" is currently active
int [][] curr; // current generation of ca
int [][] prev; // previous generation of ca

The purpose of each variable is written beside it. The code will require the placement of numbers so that the complex, changing design can be created. W, H, S, C and R have been implemented in various places in the code. For example, C and R have been given the screen width/ screen height divided by scale of pixels. This is so that the number of columns and rows do not remain stable, creating the moving effect of the green and black pixels.

Through analysing this code, I was able to realise that variables can be the sum of two or more variables divided by each other, multiplied, added, subtracted etc. Variables can have an effect on the number other variables represent. This puts me in mind of hybrid objects/tools and animals, but I'll get to the metaphors in a later post...

Code Three:



This code consists of various moving triangles, which can change colour depending on the type of mouse click. This is at the start of the code:

float x = random(400,width);
float y = random(300,height);
float w = random(0,200);
float h = random(0,200);
float d = random(0,200);

These variables are used later in the 'void shake' function. Lines such as this 'x = x+random(-1,1)*speed;' are used to create the moving shapes. Here, the random with 400 pixels height and random width is shown with an x, to which random is added, coordinates are given and a speed is assigned. This is effectively creating the speed of the moving triangles. Beneath it the same is done with variables x, y, w and h. Similar coding is used to constrain the area of movement and the scale of the triangles.

All three of these codes use variables to indicate something random. Numbers are arbitrarily chosen so that the movement of each of these interactive designs is never exactly the same as the last movement (some exception in Code Two as it will only change if you click/type a number). Variables are also used to input numbers which stay the same and can be added onto, sometimes using other variables. The codes retrieve these numbers from the int or float variables in several places, making each code intricate, but not excessively long.

Monday 2 May 2011

Final Transformation

Over the break, I researched imagery relating to triangles and the sound waves they create. There were a limited amount of images, but these two inspired some sketches that I thought could be used in an interactive programme.




Drawing from these images and earlier sketches, I created my final Transformation. The colours and triangular imagery in the sketch in my post 'Transformation' inspired my own design. The accumulation of my drawings and my experimentation with arrays allowed me to end up with this programme.