Interaction Design WikiProgramming

Modifying rotation by distribution


int gridW = 14;
int gridH = 14;
int border = 70;
int stepX = 50;
int stepY = 50;
int graphicSize = 25;

void setup()
{
  size(800, 800);
  noStroke();
  fill(0);
  background(255);
  rectMode(CENTER);
  float rotation = 0;
  translate(border, border);
  for (int i=0; i < gridH; i++)
  {
    for (int j = 0; j < gridW; j++)
    {
      rotation++;
      pushMatrix();
      translate(j * stepX, i * stepY);
      rotate(radians(rotation));
      rect(0, 0, graphicSize, graphicSize);
      popMatrix();
    }
  }
}