need help with program that uses arrays
in
Programming Questions
•
2 years ago
Hey, if i wanted to make all the little dots look as though they were moving around, kind of like on a television screen, what would I do?
// Example: 2D Array
size(800,600);
int cols = width;
int rows = height;
// Declare 2D array
int[][] myArray = new int[cols][rows];
// Initialize 2D array values
for (int i = 0; i < cols; i++) {
for (int j = 0; j < rows; j++) {
myArray[i][j] = int(random(255));
}
}
// Draw points
for (int i = 0; i < cols; i++) {
for (int j = 0; j < rows; j++) {
stroke(myArray[i][j]);
point(i,j);
}
}
1