#### Howdy, Stranger!

We are about to switch to a new forum software. Until then we have removed the registration on this forum.

# help (serpentining)

edited May 2015

could someone help me get started on this project?

1. Make a row of 20 squares. Make their fill colour gradually change from white to black, slowly over time.

2. Now make them go back to white, slowly over time.

3. Now make it look as though the change occurs as a "wave" of white moving through the row of boxes, from left to right (and then wraps). (If this sounds weird, don't worry, I'll explain at the board.)

4. CHALLENGE: Now, instead of a single row, make it a 20x20 grid of squares! The "ripple" propagates through the grid, one row at a time: left to right in row 1, then right to left in row 2, etc. This is called "serpentining", for reasons which may or may not be obvious :)

Tagged:

• make a basic sketch with setup() and draw()

make a for-loop and paint rects in a row

• edited May 2015
``````void setup() {
size(800,200);

for (int j = 0; j < 20; j=j+1) {
fill(11*j);
rect(j*40,100,30,30);
}
}
``````

i got this what should be the next code?

• edited May 2015

Make their fill colour gradually change from white to black,

use a variable to do so

`color myFill = color (0);`

• edited May 2015

you need a function `draw()` (as I have written before)

and have the for-loop in `draw()`

use `background(0);` at the beginning of `draw()`

• edited May 2015

just read the assignment and make it step by step...

• go back, edit your post

• leave 2 empty lines before and after

• select the code

• hit ctrl-o

• come back when you have a question

• ;-)

1. we discussed - the var starts with 255 and gets `--` . All rects same color.
2. when it becomes zero instead of `--` use `++`; can you think of a better way? Once we add -1, once we add 1. All rects same color.