Fading transition between two images

edited November 2013 in How To...

Hey all,

I am trying to create a fading transition between different images within a state machine I have. To give a watered down snip of my code, here is what I mean:

switch (pages){

case pageOne:


image(imageOne, 0, 0);

if(someCondition==true){

pages = States.pageTwo
break;
}

case pageTwo:


fill(0, 100); //this works to fade out to a black transition, but I want a crossfade into the other image. 
image(imageTwo, 0, 0);


}

Answers

  • SOLVED:

          if ( millis() > timer1 ) {
    
      frame = (frame+1) % 255;  // Use % to cycle through frames
    
            timer1+=delay1;
    
    
    //fill(255, timer1);
    
          tint(255,frame);
          fill(0);
        rectMode(CORNER);
      rect(0,0,width,height);
        image(livingRoom, 0, 0);
    
    
          }
    
Sign In or Register to comment.