Examples updates to 640 x 360 pixels

This commit is contained in:
Casey Reas
2011-08-05 18:26:51 +00:00
parent f1c7aabf14
commit 9b7de8d6b7
52 changed files with 295 additions and 302 deletions
@@ -23,7 +23,7 @@
// Logical OR: ||
// Assignment: = += -= *= /= %=
size(200, 200);
size(640, 360);
background(51);
noFill();
stroke(51);
@@ -32,25 +32,25 @@ stroke(204);
for(int i=0; i< width-20; i+= 4) {
// The 30 is added to 70 and then evaluated
// if it is greater than the current value of "i"
// For clarity, write as "if(i > (30 + 70)) {"
if(i > 30 + 70) {
// For clarity, write as "if (i > (30 + 70)) {"
if (i > 30 + 70) {
line(i, 0, i, 50);
}
}
stroke(255);
// The 2 is multiplied by the 8 and the result is added to the 5
// The 2 is multiplied by the 8 and the result is added to the 4
// For clarity, write as "rect(5 + (2 * 8), 0, 90, 20);"
rect(4 + 2 * 8, 52, 90, 48);
rect((4 + 2) * 8, 100, 90, 49);
rect(4 + 2 * 8, 52, 290, 48);
rect((4 + 2) * 8, 100, 290, 49);
stroke(153);
for(int i=0; i< width; i+= 2) {
for (int i = 0; i < width; i+= 2) {
// The relational statements are evaluated
// first, and then the logical AND statements and
// finally the logical OR. For clarity, write as:
// "if(((i > 10) && (i < 50)) || ((i > 80) && (i < 160))) {"
if(i > 20 && i < 50 || i > 100 && i < width-20) {
// "if(((i > 20) && (i < 50)) || ((i > 100) && (i < width-20))) {"
if (i > 20 && i < 50 || i > 100 && i < width-20) {
line(i, 151, i, height-1);
}
}