int x = max(0, width); int y = max(0, height); PImage a,b,c,d; float mydist; float a_alpha; float b_alpha; float c_alpha; float d_alpha; void setup() { size(500,500); background(255,0); smooth(); a = loadImage("logo1.png"); b = loadImage("logo2.png"); c = loadImage("logo3.png"); d = loadImage("logo4.png"); } void draw(){ background(255,0); mydist = dist(height/2,width/2,mouseX,mouseY); smooth(); frameRate(30); //upper left if(mouseX < 250 && mouseY < 250){ smooth(); a_alpha = mydist; imageMode(CENTER); //image(a,height/2,width/2); } //upper right if(mouseX > 250 && mouseY < 250){ smooth(); c_alpha = mydist; //tint(255, 255, 255, mydist); imageMode(CENTER); //image(c,height/2,width/2); } //lower right if(mouseX > 250 && mouseY > 250){ smooth(); d_alpha = mydist; //tint(255, 255, 255, mydist); imageMode(CENTER); //image(d,height/2,width/2); } //lower left if(mouseX < 250 && mouseY > 250){ smooth(); b_alpha = mydist; //tint(255, 255, 255, mydist); imageMode(CENTER); //image(b,height/2,width/2); } //images here for alpha to work tint(255, 255, 255, a_alpha); image(a,height/2,width/2); tint(255, 255, 255, c_alpha); image(c,height/2,width/2); tint(255, 255, 255, d_alpha); image(d,height/2,width/2); tint(255, 255, 255, b_alpha); image(b,height/2,width/2); } void mouseMoved() { x = mouseX/2; y = mouseY/2; }