/** * Groeningemonument

* Doodgeslagen Franse aanvoerder Robert d'Artois: * schuif met de cursor over het beeldvlak en klik door naar het volgende tafereel. */ PImage img; PImage img2; boolean overLeftButton = false; boolean overRightButton = false; void setup() { size(1015,675); background(255); } void draw() { img = loadImage( "slag1302_kortrijkdef2.jpg" ); image(img,0,0); loadPixels(); for (int x = 0; x < img.width; x++ ) { for (int y = 0; y < img.height; y++ ) { int loc = x + y*img.width; float r = red (img.pixels[loc]); float g = green (img.pixels[loc]); float b = blue (img.pixels[loc]); float distance = dist(x,y,mouseX,mouseY); float adjustBrightness = (210-distance)/210; r *= adjustBrightness; g *= adjustBrightness; b *= adjustBrightness; r = constrain(r,0,255); g = constrain(g,0,255); b = constrain(b,0,255); color c = color(r,g,b); pixels[loc] = c; } } updatePixels(); if(overLeftButton == true) { img2 = loadImage("schild.jpg"); image(img2,250,217); } else { noFill(); } stroke(204,0,0); rect(450,360,300,250); if(overRightButton == true) { noFill(); } else { noFill(); } noStroke(); rect(0, 0, 10, 10); } void mousePressed() { if(overLeftButton) { link("http://www.handiginhuis.be/KT_nl/leeuw_van_vlaanderen/applet/index.html"); } else if (overRightButton) { link("http://www.handiginhuis.be/KT_nl/leeuw_van_vlaanderen/applet/index.html", "_new"); } } void mouseMoved() { checkButtons(); } void mouseDragged() { checkButtons(); } void checkButtons() { if(mouseX > 400 && mouseX < 760 && mouseY > 350 && mouseY < 620) { overLeftButton = true; } else if (mouseX > 400 && mouseX < 760 && mouseY > 350 && mouseY <620) { overRightButton = true; } else { overLeftButton = overRightButton = false; } }