Thursday, 12 April 2012

Seven Segment Class Code

class sevenSegments{
public void segment(int w,int H ){

  float x=5;
float y=5;
float x1=w*.1;
float x2=w*.2;
float x3=w*.6;
float x4=x3;
float x5=x2;
float x6=x1;
float x7=x2;
float y1=H*.2;
float y2=H*.1;
float y3=y1;
float y4=H*.45;
float y5=H*.8;
float y6=y4;
float y7=H*.45;


 

rect(x1,y1,10,40);  // 1 upper left
rect(x2,y2,40,10);  // 2 upper
rect(x3,y3,10,40);  // 3 upper right
rect(x4,y4,10,40);  // 4 lower right
rect(x5,y5,40,10);  // 5 lower
rect(x6,y6,10,40);  // 6 lower left
rect(x7,y7,40,10);  // 7 Mid rect
}
}
sevenSegments ss= new sevenSegments();
void setup(){
 
size(300,300);


}
void draw(){
 
  background(200,100,200);
 
ss.segment(100,100);
}

No comments:

Post a Comment