We closed this forum 18 June 2010. It has served us well since 2005 as the ALPHA forum did before it from 2002 to 2005. New discussions are ongoing at the new URL http://forum.processing.org. You'll need to sign up and get a new user account. We're sorry about that inconvenience, but we think it's better in the long run. The content on this forum will remain online.
IndexProgramming Questions & HelpSyntax Questions › disappearing PImage
Page Index Toggle Pages: 1
disappearing PImage (Read 371 times)
disappearing PImage
Dec 30th, 2007, 3:37pm
 
Hi Guys! A little noob question... I want create a rollover, but I don't know how to get the "disappear-effect" for my rollover rect! It would be great, if the PImage disappears by leaving the rect with the cursor. (Sorry for my bad english.)
Thank you in advance for your help!

The code:

PImage photo;

void setup(){
 size(500,450);
 background(255);
 photo= loadImage("sebo.jpg");
 }
 
void sebophoto(int x, int y){
 image(photo,x,y);
 }
 
void roll(){
 rect(0,0,100,100);
 }

void draw(){
  roll();
}
void mouseMoved() {
   if(mouseX<100&&mouseY<100){
     sebophoto(width/2,height/2);
 }
}
Re: disappearing PImage
Reply #1 - Dec 31st, 2007, 7:32am
 
you need to erase everything at each frame, using the background() method :

Code:
void draw(){
background(255);
roll();
}
Re: disappearing PImage
Reply #2 - Dec 31st, 2007, 1:34pm
 
Thank you! Now it's perfect. Happy new Year! : D
Page Index Toggle Pages: 1