12
edits
Line 93: | Line 93: | ||
Simple pattern in which depending on the position of the Mouse in the Y axis, the pattern starts to get "erased" from the middle. | Simple pattern in which depending on the position of the Mouse in the Y axis, the pattern starts to get "erased" from the middle. | ||
void setup () { | void setup () { | ||
size (1000,1000); | size (1000,1000); | ||
} | } | ||
void draw () { | void draw () { | ||
background (209); | background (209); | ||
noStroke (); | noStroke (); | ||
fill (155,0,0); | fill (155,0,0); | ||
//pushMatrix(); | //pushMatrix(); | ||
Squares(); | Squares(); | ||
//popMatrix(); | //popMatrix(); | ||
float ValueX = mouseX; | float ValueX = mouseX; | ||
float ValueY = mouseY; | float ValueY = mouseY; | ||
pushMatrix(); | pushMatrix(); | ||
translate(500,500); | translate(500,500); | ||
rectMode(CENTER); | rectMode(CENTER); | ||
Line 119: | Line 119: | ||
rectMode(CORNER); | rectMode(CORNER); | ||
popMatrix(); | popMatrix(); | ||
} | } | ||
void Squares(){ | void Squares(){ | ||
rect (400,0,200,100); | rect (400,0,200,100); | ||
Line 157: | Line 157: | ||
rect (400,900,200,100); | rect (400,900,200,100); | ||
} | } | ||
Line 164: | Line 164: | ||
void setup() { | void setup() { | ||
size(600, 600); | size(600, 600); | ||
noSmooth(); | noSmooth(); | ||
fill(255,0,0); | fill(255,0,0); | ||
background(102); | background(102); | ||
} | } | ||
void draw() { //Setting the colors for pattern A | void draw() { //Setting the colors for pattern A | ||
if (mousePressed) { | if (mousePressed) { | ||
stroke(255,0,0); | stroke(255,0,0); | ||
Line 301: | Line 301: | ||
translate(0, 550); | translate(0, 550); | ||
RowOdd(); | RowOdd(); | ||
popMatrix(); | popMatrix(); | ||
} | |||
} | |||
void RowOdd(){ | void RowOdd(){ | ||
rect(0,0,50,50); | rect(0,0,50,50); | ||
rect(100,0,50,50); | rect(100,0,50,50); | ||
Line 314: | Line 311: | ||
rect(400,0,50,50); | rect(400,0,50,50); | ||
rect(500,0,50,50); | rect(500,0,50,50); | ||
} | } | ||
void RowEven(){ | void RowEven(){ | ||
Line 323: | Line 320: | ||
rect(450,0,50,50); | rect(450,0,50,50); | ||
rect(550,0,50,50); | rect(550,0,50,50); | ||
} | } | ||
* Pattern C | |||
In this pattern I wanted to draw the same checkerboard pattern but this time, all the squares would rotate on their own axis to reveal the one behind it (with a different color). So far I have not been able to do so, as the squares insist on all rotating from the same point. I'm uploading this while I try to figure it out, if someone else has an idea feel free to post it here. | |||
<post ideas here> | |||
<post ideas here> | |||
void setup () { | |||
size (500,500); | |||
} | |||
void draw () { | |||
background (209); | |||
rectMode(CENTER); | |||
float Mouse = mouseX; | |||
pushMatrix(); | |||
translate(50,50); | |||
rotate(radians(mouseX)); | |||
Ele1(); | |||
popMatrix(); | |||
pushMatrix(); | |||
translate(50,50); | |||
//rotate(mouseX); | |||
Ele2(); | |||
popMatrix(); | |||
} | |||
void Ele1(){ | |||
pushMatrix(); | |||
rect(0,0,100,100); | |||
popMatrix(); | |||
} | |||
void Ele2(){ | |||
pushMatrix(); | |||
rect(200,0,100,100); | |||
popMatrix(); | |||
} | |||
void Ele3(){ | |||
// pushMatrix(); | |||
// rotate(radians(mouseX)); | |||
rect(400,0,100,100); | |||
// popMatrix(); | |||
} |
edits