void slidePattern(int pattern, int del) {
for (int l = 0; l < 8; l++) {
for (int i = 0; i < 7; i++) {
for (int j = 0; j < 8; j++) {
leds[j][i] = leds[j][i+1];
}
}
for (int j = 0; j < 8; j++) {
leds[j][7] = patterns[pattern][j][0 + l];
}
delay(del);
}
}
This function on that page is responsible for "sliding" the existing contents of the leds[][] array out of view, and replacing them with another pattern. In particular, leds[j] = leds[j][i+1];[/b] sets a given LED to the value on its right-- do this for all LEDs in the correct order, and you'll see the whole image shift leftward one spot. Then the statement leds[j][7] = patterns[pattern][j][0 + l]; deals with an LED in the rightmost column, by filling it with the appropriate cell in the next column of the new pattern. It's a very straight-forward routine. You could write three other similar routines that slide the contents in other directions.
void slidePattern(int pattern, int del) {
// Loop 8 times, once for each column of new character to scroll in
for (int loop = 0; loop < 8; loop++) {
// First shuffle existing columns 1 to 7 into cols 0 to 6
for (int i = 0; i < 7; i++) {
// Do each row of each column
for (int j = 0; j < 8; j++) {
leds[j][i] = leds[j][i+1];
}
}
// Now copy new column from pattern onto end column of display
for (int j = 0; j < 8; j++) {
leds[j][7] = patterns[pattern][j][0 + loop];
}
// Wait for a bit
delay(del);
} // end loop for each column of new pattern
} // end function
Designrats, if you've tried a bit of tinkering there, but came up with ugly results, then perhaps you might not have noticed a key phrase in my reply: do this for all LEDs in the correct order.
If you're scrolling columns rightward, you will need to visit all the columns in the opposite order as the given loop, otherwise each copy will damage data you've just written.
Likewise, if you're sliding up or down, then the order you visit the columns isn't important, but the order you copy the rows is key.