/** * Stadhuis: * schuif met de cursor over het beeldvlak.
Keer terug */ int totalSquares = 3*3*3*3; int rectAlphaArray[][]; float alphaChangeRate = 1; void setup () { size(1000,665); rectAlphaArray = new int[floor(sqrt(totalSquares))][floor(sqrt(totalSquares))]; for(int i=0; i < sqrt(totalSquares); i++){ for(int j=0; j < sqrt(totalSquares); j++){ rectAlphaArray[i][j] = 200; println("rectpoint 1 of x="+i+", y="+j+" = ("+(i * (width/(sqrt(totalSquares))))+", "+(j * (height/(sqrt(totalSquares))))+")"); } } } void draw(){ background(0); noStroke(); PImage photo; size(1000,665); photo = loadImage("stadhuis.jpg"); image(photo,0,0); for(int x = 0; x < sqrt(totalSquares); x++){ for(int y = 0; y < sqrt(totalSquares); y++){ if((mouseX > (x * (width/(sqrt(totalSquares))))) && (mouseX < ((x * (width/(sqrt(totalSquares)))) + (width/(sqrt(totalSquares))))) && (mouseY > (y * (height/(sqrt(totalSquares))))) && (mouseY < ((y * (height/(sqrt(totalSquares)))) + (height/(sqrt(totalSquares)))))){ rectAlphaArray[x][y] = 0; } else{ if (rectAlphaArray[x][y] < 255) { rectAlphaArray[x][y] += alphaChangeRate; } fill(255,255,102, rectAlphaArray[x][y]); rect(floor((x * (width/(sqrt(totalSquares))))), floor((y * (height/(sqrt(totalSquares))))), floor((width/(sqrt(totalSquares)))), floor((height/(sqrt(totalSquares))))); fill(0); rect(0,0,1,665); fill(0); rect(0,0,999,1); fill(0); rect(999,0,1,665); fill(0); rect(0,664,999,1); fill(0,0,204); rect(222,220,111,148); fill(255,255,0); rect(333,146,111,148); fill(0,0,0); rect(444,220,111,148); fill(255,0,0); rect(556,146,111,148); fill(255,255,255); rect(666,220,111,148); fill(0); rect(111,0,1,665); fill(0); rect(222,0,1,665); fill(0); rect(333,0,1,665); fill(0); rect(444,0,1,665); fill(0); rect(555,0,1,665); fill(0); rect(666,0,1,665); fill(0); rect(777,0,1,665); fill(0); rect(888,0,1,665); fill(0); rect(0,73,999,1); fill(0); rect(0,146,999,1); fill(0); rect(0,220,999,1); fill(0); rect(0,294,999,1); fill(0); rect(0,368,999,1); fill(0); rect(0,442,999,1); fill(0); rect(0,516,999,1); fill(0); rect(0,590,999,1); fill(0,0,204); rect(223,293,111,2); fill(255,255,255); rect(667,293,110,2); fill(255,255,0); rect(334,219,110,2); fill(255,0,0); rect(556,219,110,2); } } } }