Albers Simulator

Josef Albers (1888-1976) is probably best known for his series, begun in 1949, of Homage to the Square, where he explored the chromatic interactions between nested squares. He explored this theme through hundreds of paintings and prints, typically featuring three or four nested squares.


This is a program to simulate the work of Josef Albers

Here’s what to do;

Click left mouse button to change all colours

Click right mouse button on a segment to change its colour

//Info: http://processingjs.org/reference

void setup() {
smooth();
size(600, 600);
noStroke();
background(255);
rectMode(CORNERS);

draw1(); // draw initial image
draw2();
draw3();
draw4();
}

void draw() {
}

void mousePressed() {

if (mousePressed &&(mouseButton == LEFT)) { // redraw whole image mith mouse LEFT
draw1();
draw2();
draw3();
draw4();
}

if (mousePressed &&(mouseButton == RIGHT)) { // redraw only the square clicked with mouse RIGHT

if (((mouseX >= 190) && (mouseX = 280) && (mouseY = 130) && (mouseX = 190) && (mouseY = 70) && (mouseX = 100) && (mouseY <= 560))) {
colour3();
draw3();
}
else {
colour4();
draw4();
}
}
}

void draw4() {
colour4(); // random colour
rect(10, 10, 590, 100);// largest square 4
rect(10, 560, 590, 590);
rect(10, 100, 70, 560);
rect(530, 100, 590, 560);
}

void draw3() {
colour3();
rect(70, 100, 530, 190);// next largest square 3
rect(70, 530, 530, 560);
rect(70, 190, 130, 530);
rect(470, 190, 530, 530);
}

void draw2() {
colour2();
rect(130, 190, 470, 280); // next largest square 2
rect (130, 500, 470, 530);
rect (130, 280, 190, 500);
rect (410, 280, 470, 500);
}

void draw1() {
colour1();
rect(190, 280, 410, 500); // smallest square 1
}

void colour1 () {
fill (random(20, 230), random(20, 230), random(20, 230));
}

void colour2 () {
fill (random(35, 215), random(35, 215), random(35, 215));
}

void colour3 () {
fill (random(45, 200), random(45, 200), random(45, 200));
}

void colour4 () {
fill (random(60, 180), random(60, 180), random(60, 180));
}

Leave a Reply

Your email address will not be published.