Mondrian Simulator

In 1917, before he introduced the grid into his work, Piet Mondrian painted Composition with Line, consisting of a series of horizontal and vertical elements arranged on the canvas. He was trying to intuitively express a sense of harmony and beauty through the use of basic purely geometric forms.

This computer program allows you to create your own version of Composition with Line 1917,

Composition With Lines (1917)
Composition With Lines (1917)









Here’s what to do;

Hold down the left mouse button and move around the canvas.

Press any key to erase and start again

// <![CDATA[

void setup() {
size (500, 500);
background (235, 240, 230);
stroke (15, 35, 20, 200);
// ellipse(300,300,600,600);
frameRate (5);

void draw() {

float shiftx=random(16);
float shifty=random(20);

if (mousePressed) {
stroke (15, 35, 20, 200); //draw if mouse button pressed
else {
noStroke(); //don't draw if mouse button not pressed
int x=mouseX;
int y=mouseY;
line(x, y, x+random(10, 30), y); // horizontal line
line(x+shiftx, y-shifty, x+shiftx, y+shifty); //vertical line

void keyPressed() {
background (235, 240, 230);

Leave a Reply

Your email address will not be published. Required fields are marked *