Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- int numCol = 10, numRow = 5;
- float colSize, rowSize;
- void setup() {
- size(500, 500);
- background(255);
- frameRate(3);
- colSize = width/numCol;
- rowSize = height/numRow;
- }
- void draw() {
- //float randColor1 = random(100, 200); -> not needed since you can simple add random() later in your fill() function?
- //float randColor2 = random(100, 200);
- //float randColor3 = random(100, 200);
- for (int i=0; i<numCol; i++) {
- //fill(random(100, 200), randColor1, randColor3, 100); //why would you want to do this here?
- for (int j=0; j<numRow; j++) {
- fill(random(100, 200), random(50, 150), random(100, 200), 100); //why use you randColors here instead of simply using random()?
- //rect((width/numCol) * i, (height/numRow) *j, (width/numCol) * i, (height/numRow) * j);
- rect(colSize*i, rowSize*j, colSize, rowSize); // the 3rd and 4th argument only need to be the size of one rectangle! your code created huge rectangles (that were hidden by the screen being too small), I think that also explains the offset in some way ... I'm not sure why though ... my rewrite starts at 0,0
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement