Processing #2

From the first Processing workshop, I learnt some of the basic functions and some of the basic lines of code. In the second Processing workshop the aim of the workshop was to create a pattern using different shape functions. The first thing to set up was the canvas. For this I used a sizing of 800×800 then for the background colour, I used a random fill of rect() with the colour values of black and white. The full code looks like this:


void setup(){
size(800,800);
frameRate(25);
smooth();
colorMode(HSB, 100);

for (int y=0;y<height;y=y+60){
for (int x=0;x<height;x=x+60){
fill(random(100),70);
rect(x,y,60,60);
}
}
}

This meant that when the Processing file loaded up, the background would have a black and white squared pattern. Which looked like:

Screen Shot 2015-01-09 at 14.18.01

This background works for the sketch as it emphasises the different uses of patterns and colour values. The basic function of this Processing tutorial was to show the different pattern techniques you can use. The next thing to implement on this canvas was a spiral pattern. The purpose of this was to experiment with different shapes and functions in Processing as we are still learning this new program. To make the spiral effect, the code needed looks like this:


void setup(){
size(800,800);
frameRate(25);
smooth();
colorMode(HSB, 100);

for (int y=0;y<height;y=y+60){
for (int x=0;x<height;x=x+60){
fill(random(100),70);
rect(x,y,60,60);
}
}
}

int s = 0;
int r = 0;
float h = 0;

void draw(){
translate(width/2, height/2);
rotate(r);
r=r+1;
fill(h,100,100,20);
h=(h+0.5)%100;
rect(0,0,s,s/6);
s=(s+2)%(width/2);
if (mousePressed){
save("an_image.png");
}
}
<pre>

With this code, the finished product looks like:

Screen Shot 2015-01-09 at 15.34.46

The finished Processing piece combines both the background pattern using shapes and the shapes that make the spiral pattern. The reasoning behind this piece of Processing is to experiment with different shapes and how they interact with one an other. I feel as though I have learnt a lot from this workshop as I have discovered how to use shape functions and how to create patterns using these functions. I can apply what I have learnt in this workshop to future projects as, using shapes in Processing is a key element in creating new pieces of Processing.

Advertisements

Leave a Reply

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

WordPress.com Logo

You are commenting using your WordPress.com 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