Based on: Untitled by Alex Makarovitsch, 1977
Category: direct
Description:
This sketch is running in the browser.
/* Part of the ReCode Project (http://recodeproject.com) Based on "Untitled" by Alex Makarovitsch Originally published in "Computer Graphics and Art" v2n4, 1977 Copyright (c) 2013 Filippo Vanucci - OSI/MIT license (http://recodeproject/license). */ /*@pjs pauseOnBlur="true"; */ int margin = 8; int shapeSize = 60; int shapeOffset = 6; int rows = 5; int cols = 5; void setup() { size(340, 340, P3D); smooth(); noFill(); stroke(0); strokeWeight(2); drawGrid(); } void draw() {} void drawGrid() { background(255); for(int y=0; y < rows; y++) { for(int x=0; x < cols; x++) { PVector position = new PVector(margin + shapeSize/2 + shapeSize*x, margin + shapeSize/2 + shapeSize*y, 0); boolean doRotationX = random(0,1) > 0.5; boolean doRotationZ = random(0,1) > 0.5; drawShape(position, doRotationX, doRotationZ); } } } void drawShape(PVector position, boolean doRotationX, boolean doRotationZ) { pushMatrix(); translate(position.x, position.y); for(int i=0; i < 5; i++) { pushMatrix(); translate(shapeOffset*i, shapeOffset*i); if(doRotationZ) rotate(PI/2.0); if(doRotationX) rotateX(PI); line(-shapeSize/2, shapeSize/2, -shapeSize/2, -shapeSize/2); line(0, shapeSize/2, 0, -shapeSize/2); line(shapeSize/2, -shapeSize/2, shapeSize/2, shapeSize/2); line(-shapeSize/2, -shapeSize/2, 0, -shapeSize/2); line(0, shapeSize/2, shapeSize/2, shapeSize/2); popMatrix(); } popMatrix(); } void mousePressed() { drawGrid(); }