Thursday, July 23, 2009

Sweatshop

float beginX = 20.0;  // Initial x-coordinate
float beginY = 10.0;  // Initial y-coordinate
float endX = 200;   // Final x-coordinate
float endY = 300;   // Final y-coordinate
float distX;          // X-axis distance to move
float distY;          // Y-axis distance to move
float exponent = 4;   // Determines the curve
float x = 0.0;        // Current x-coordinate
float y = 0.0;        // Current y-coordinate
float step = 0.01;    // Size of each step along the path
float pct = 0.5;      // Percentage traveled (0.0 to 1.0)
int c1, c2, c3;       // RGB Colours
int span;             // common variable for all polygons
int armWidth, armHeight; // Arms of the T-Shirt 
int rectWidth, rectHeight, rectWidthCentre;
int triHeight; //Random height of V neck


void setup() 
{
  size(800, 550);
  noStroke();
  //smooth();
  distX = endX - beginX;
  distY = endY - beginY;
  frameRate(25);
}

void draw() {
  noStroke();
  c1 = (int)random(255);
  c2 = (int)random(255);
  c3 = (int)random(255);
  
  span = (int)random(15,25);
  
  armWidth = (int)random(50,100);
  armHeight = (int)random(50,100);
  
  rectWidth = (int)random(25,35);
  rectHeight = (int)random(70,95);
  
  rectWidthCentre = (int)random(20,45);
  
  triHeight = (int)random(10,15);
  
  
  //BACKGROUND
 
  fill(c1,c2,c3, 5);
  rect(0, 0, width, height);
 
   pct += step;
  if (pct < 1.0) {
    x = beginX + (pct * distX);
    y = beginY + (pow(pct, exponent) * distY);
  }
  
  
   
   
   //LEFT AND RIGHT ARM
  
  
  //left
  noStroke();
  fill(c1,c2,c3);
  arc(x+span, y, armWidth+10, armHeight, 1, 2 );
  
  //right
   arc(x+span+rectWidth*2+rectWidthCentre, y, armWidth, armHeight, 1, 2 );
  
  
  
  
  //LEFT AND RIGHT RECTANGLES
  
  //left
   noStroke();
   fill(c1,c2,c3);
  rect(x+span, y, rectWidth, rectHeight);
  //right
   noStroke();
   fill(c1,c2,c3);
  rect(x+span+rectWidth+rectWidthCentre, y, rectWidth, rectHeight);
  
  
  
  //CENTRE RECTANGLE
  noStroke();
  fill(c1,c2,c3);
  rect(x+span+rectWidth, y+triHeight, rectWidthCentre, rectHeight-triHeight);
  
  
  //TRIANGLES
  noStroke();
  fill(c1,c2,c3);
  triangle(x+span+rectWidth, y, x+span+rectWidth, y + triHeight, x+span+rectWidth+(rectWidthCentre/2), y+triHeight);
  triangle(x+span+rectWidth +(rectWidthCentre/2), y + triHeight, x+span+rectWidth+rectWidthCentre, y, x+span+rectWidth+rectWidthCentre, y + triHeight);
  

 
 //Right Arm

}

void mousePressed() {
  pct = 0.0;
  beginX = x;
  beginY = y;
  endX = mouseX;
  endY = mouseY;
  distX = endX - beginX;
  distY = endY - beginY;
}

info info

submitted by: ric_lmc
views: 2238
The Sweatshop

Tags:

comments comment

loading loading...

 

Add a comment: