Wednesday, April 04, 2012
Perspective_trick_3
//declaring varialbes needed
int a = 0;
void setup() {
size(500,500);
//background set so fills can later be matched for invisible squares
background(200,200,200);
}
void draw() {
//random colours set
stroke(random(0,255),random(0,255),random(0,255));
//random length set
a = random(200,375);
//random lines placed
line(0,0,250,a);
line(500,500,a-100,225);
line(0,500,a,225);
line(500,0,225,a);
line(0,250,200,a);
line(250,0,a-50,250);
line(250,500,a-50,250);
line(500,250,250,a-25);
//setting colours to make it invisible
stroke(200,200,200);
fill(200,200,200);
//triangles are added to keep the lines neat, obscuring any that are out of line (pun unintended).
triangle(0,0,0,250,150,225);
triangle(0,500,0,250,150,325);
triangle(0,0,250,0,190,152);
triangle(0,500,250,500,195,358);
triangle(250,500,500,500,290,357);
triangle(250,0,500,0,290,150);
triangle(500,0,500,250,350,205);
stroke(0,0,0);
//whole section commented due to being for debug
//strokeWeight(2);
//line(0,0,250,200);
//line(0,0,250,375);
//line(500,500,100,225);
//line(500,500,275,225);
//line(0,500,200,225);
//line(0,500,375,225);
//line(500,0,225,200);
//line(500,0,225,375);
//line(0,250,200,200);
//line(0,250,200,375);
//line(250,0,150,250);
//line(250,0,325,250);
//line(250,500,150,250);
//line(250,500,325,250);
//line(500,250,250,175);
//line(500,250,250,350);
//this area was removed because the lines are inaccurate, and these appear to have priority over the triangles.
}
int a = 0;
void setup() {
size(500,500);
//background set so fills can later be matched for invisible squares
background(200,200,200);
}
void draw() {
//random colours set
stroke(random(0,255),random(0,255),random(0,255));
//random length set
a = random(200,375);
//random lines placed
line(0,0,250,a);
line(500,500,a-100,225);
line(0,500,a,225);
line(500,0,225,a);
line(0,250,200,a);
line(250,0,a-50,250);
line(250,500,a-50,250);
line(500,250,250,a-25);
//setting colours to make it invisible
stroke(200,200,200);
fill(200,200,200);
//triangles are added to keep the lines neat, obscuring any that are out of line (pun unintended).
triangle(0,0,0,250,150,225);
triangle(0,500,0,250,150,325);
triangle(0,0,250,0,190,152);
triangle(0,500,250,500,195,358);
triangle(250,500,500,500,290,357);
triangle(250,0,500,0,290,150);
triangle(500,0,500,250,350,205);
stroke(0,0,0);
//whole section commented due to being for debug
//strokeWeight(2);
//line(0,0,250,200);
//line(0,0,250,375);
//line(500,500,100,225);
//line(500,500,275,225);
//line(0,500,200,225);
//line(0,500,375,225);
//line(500,0,225,200);
//line(500,0,225,375);
//line(0,250,200,200);
//line(0,250,200,375);
//line(250,0,150,250);
//line(250,0,325,250);
//line(250,500,150,250);
//line(250,500,325,250);
//line(500,250,250,175);
//line(500,250,250,350);
//this area was removed because the lines are inaccurate, and these appear to have priority over the triangles.
}