Open main menu

CDOT Wiki β

FSOSS 2010/processing.js/example7

Revision as of 10:57, 26 October 2010 by Asalga (talk | contribs) (Created page with 'category:FSOSS 2010 PJS Examples <source lang="JavaScript"> void setup() { size(400, 100); background(255); for (int i = 10; i < 350; i = i + 50) { cleanHouse(i,…')
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)


void setup()
{
  size(400, 100);
  background(255);
  for (int i = 10; i < 350; i = i + 50)
  {
    cleanHouse(i, 20);
  }
}

void messyHouse(int x, int y)
{
  triangle(x + 15, y, x, y + 15, x + 30, y + 15);
  rect(x, y + 15, 30, 30);
  rect(x + 12, y + 30, 10, 15);
}

void cleanHouse(int x, int y)
{
  pushMatrix();
  translate(x, y);
  triangle(15, 0, 0, 15, 30, 15);
  rect(0, 15, 30, 30);
  rect(12, 30, 10, 15);
  popMatrix();
}