FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

Improving header comment to set user expectation. · pif/processing@145c639 · GitHub

Repository navigation

Commit 145c639

Browse files
Yong Bakos
committed
Improving header comment to set user expectation.
Cleaning up setOffset() such that it has one job: setting the offset. References processing/processing_web#45
1 parent ea1cf50 commit 145c639

2 files changed

Lines changed: 17 additions & 18 deletions

File tree

Lines changed: 10 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,39 +1,37 @@
11
/**
22
* Tile Images
3-
*
4-
* Draws an image larger than the screen by tiling it into small sections.
3+
*
4+
* Draws an image larger than the screen, and saves the image as six tiles.
55
* The scaleValue variable sets amount of scaling: 1 is 100%, 2 is 200%, etc.
66
*/
77

88
int scaleValue = 3; // Multiplication factor
99
int xoffset = 0; // x-axis offset
1010
int yoffset = 0; // y-axis offset
1111

12-
void setup()
13-
{
12+
void setup() {
1413
size(600, 600);
1514
stroke(0, 100);
1615
}
1716

18-
void draw()
19-
{
17+
void draw() {
18+
background(204);
2019
scale(scaleValue);
21-
translate(xoffset *(-width / scaleValue), yoffset *(-height / scaleValue));
20+
translate(xoffset * (-width / scaleValue), yoffset * (-height / scaleValue));
2221
line(10, 150, 500, 50);
2322
line(0, 600, 600, 0);
23+
save("lines-" + yoffset + "-" + xoffset + ".png");
2424
setOffset();
2525
}
2626

27-
void setOffset()
28-
{
29-
save("lines-" + xoffset + "-" + yoffset + ".jpg");
27+
void setOffset() {
3028
xoffset++;
3129
if (xoffset == scaleValue) {
3230
xoffset = 0;
3331
yoffset++;
3432
if (yoffset == scaleValue) {
33+
println("Tiles saved.");
3534
exit();
3635
}
3736
}
38-
background(204);
39-
}
37+
}
Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/**
22
* Tile Images
3-
*
4-
* Draws an image larger than the screen by tiling it into small sections.
3+
*
4+
* Draws an image larger than the screen, and saves the image as six tiles.
55
* The scaleValue variable sets amount of scaling: 1 is 100%, 2 is 200%, etc.
66
*/
77

@@ -15,22 +15,23 @@ void setup() {
1515
}
1616

1717
void draw() {
18+
background(204);
1819
scale(scaleValue);
19-
translate(xoffset *(-width / scaleValue), yoffset *(-height / scaleValue));
20+
translate(xoffset * (-width / scaleValue), yoffset * (-height / scaleValue));
2021
line(10, 150, 500, 50);
2122
line(0, 600, 600, 0);
23+
save("lines-" + yoffset + "-" + xoffset + ".png");
2224
setOffset();
2325
}
2426

2527
void setOffset() {
26-
save("lines-" + xoffset + "-" + yoffset + ".png");
2728
xoffset++;
2829
if (xoffset == scaleValue) {
2930
xoffset = 0;
3031
yoffset++;
3132
if (yoffset == scaleValue) {
33+
println("Tiles saved.");
3234
exit();
3335
}
3436
}
35-
background(204);
36-
}
37+
}

0 commit comments

Comments
 (0)

Back | FazBrowse Home | New Git URL