Processing - How to tint only one image?

408 Views Asked by At

With my background set as an image, I want to play a transition effect using an image.

This is my code:

if (overStart == true) {
    overTransition = frameCount;
    overStart = false;
  }
  overTransitionEl = frameCount-overTransition;
  if (overTransitionEl<=120)
    tint(255, overTransitionEl*4.23);
  else {
    noTint();
  }
  pushMatrix();
  imageMode(CENTER);
  translate(width/2, height/2);
  image(gameOver, 0, 0);
  popMatrix();

Considering tint tints every image and not just the specific one (gameOver), the background (being an image) also fades in. Is there a workaround or do I have to leave out the transition?

Thanks!

1

There are 1 best solutions below

0
Cadin On

You can call noTint() after drawing the image to revert to normal image mode before trying to draw any other images.

The example on the reference for noTint demonstrates it pretty well.