Playing with P
in
Share your Work
•
2 years ago
Hi,
I'm just learning Processing in particular and programming in general.
I'm using the book "Getting Started with Processing".
So far I like it a lot!
Right now I'm following Chapter 3 doing all the exercises, but arriving to the colors section, at page 26, figure 3-3 map all the grayscale levels and I wondered if the authors made that graphic using Processing... It turns out that I could make it! here is my code:
size(400, 800);
background(255);
int posY = 8;
int posX = 10;
int baseColor = 0;
smooth();
noStroke();
for (int j=0; j<4; j++) {
for (int i=0; i<64; i++) {
//print(i+baseColor);
//print("\n");
fill(i+baseColor);
rect(posX, posY, 60, 10);
posY = posY + 12;
}
posX = posX+100;
posY = 8;
baseColor += 64;
}
The only thing I need to do is to put the numbers aside the rects.
So now, I'm pretty sure that they could use Processing for that!
I'll try to post my progress and experiments, please forgive this newbie if the experiments are so trivial and easy.
I'm just learning Processing in particular and programming in general.
I'm using the book "Getting Started with Processing".
So far I like it a lot!
Right now I'm following Chapter 3 doing all the exercises, but arriving to the colors section, at page 26, figure 3-3 map all the grayscale levels and I wondered if the authors made that graphic using Processing... It turns out that I could make it! here is my code:
size(400, 800);
background(255);
int posY = 8;
int posX = 10;
int baseColor = 0;
smooth();
noStroke();
for (int j=0; j<4; j++) {
for (int i=0; i<64; i++) {
//print(i+baseColor);
//print("\n");
fill(i+baseColor);
rect(posX, posY, 60, 10);
posY = posY + 12;
}
posX = posX+100;
posY = 8;
baseColor += 64;
}
The only thing I need to do is to put the numbers aside the rects.
So now, I'm pretty sure that they could use Processing for that!
I'll try to post my progress and experiments, please forgive this newbie if the experiments are so trivial and easy.