Last week, we learned how to interpret abstract pieces of artwork and tried to recreated it using sketching skill that we learned using Processing 3. The in-class workshop was to recreate the artwork called Piet Mondrian’s “Composition with Color Planes III.” on Processing 3 using Java.
In the workshop, we worked together to come up with the algorithm that creates random rectangles and colors (pink, purple and yellow). By using two-dimensional for loop and if-else conditions, we had created the sketching that closes to the original artwork, but it wasn’t good enough.
From the initial code that we wrote for the workshop, I continued to improve the sketch to look alike to the original Piet Mondrian’s artwork as much as I can. Firstly, I removed strokes of the rectangles. Then, I create a noise that looks random. The noise itself will make the sketch more realistic and similar to the original. I use the same method (2-dimentional for loop) to create noises. Also, I use the random function to create a random noise color, width, and height. The code will generate tiny rectangles on the screen.
Here is my result:
Here is my code:
void setup()
{
size(1000,800);
background(255);
color pink = color(242,169,180);
color yellow = color(208,157,39);
color purple = color(168,172,210);
// 12 pink rects, 12 purple rects, 6 yellow rects
// 5 rects per column
// 5–7 rects per row
rectMode(CENTER);
noStroke();
// drop rects for 5 rowsfor(int i=0;i<5;i++)
{
// draw out row
int rectsPerRow = (int)random(5,7);
int rowSpace = height/4;
int colSpace = width/rectsPerRow;
for(int j=0;j<rectsPerRow;j++)
{
//noiseDetail(8,0.65);
int x = 0;
int y = 0;
int w = 0; // w = width
int h = 0; // h = height
x = j*colSpace;
y = i*rowSpace;
int maxWidth = colSpace;
int minWidth = colSpace/3;
int maxHeight = rowSpace;
int minHeight = rowSpace/3;
w = (int)random(minWidth,maxWidth);
h = (int)random(minHeight,maxHeight);
float colorPick = random(0,5);
if(colorPick<2)
{
fill(purple);
}
else if(colorPick<4)
{
fill(pink);
}
else fill(yellow);
rect(x,y,w,h);
// add noise into each rect
//rectMode(CORNER);}}
//Create Noise
for (int k=0;k<width;k++)
{
for (int l=0;l<height;l++)
{
fill(random(200,255), random(200,255), random(200,255), 15); // gray color noise with 15 value alpha
float noiseWidth = random(0,4);
float noiseHeight = random(0,4);
rect(k, l, noiseWidth, noiseHeight);
}
}save(“mondrian.png”);}