We are about to switch to a new forum software. Until then we have removed the registration on this forum.
I'm trying to create a little effect in my game and i need to use the tint command for it.
What I want to know is how to create a pulse from 50% opacity to 100% opacity.
Can somebody help me?
For reference on using opacity see the second example for the tint command: https://processing.org/reference/tint_.html
As for making the opacity pulse, how about using the system variable "frameCount" (https://processing.org/reference/frameCount.html) in your draw() loop. For example:
PImage img; void setup() { size(600,600); img = loadImage("https://upload.wikimedia.org/wikipedia/en/7/78/Small_scream.png"); frameRate(20); } void draw() { noTint(); // No tint and no transparency image(img, 0, 0); tint(0, 153, 204, (frameCount % 15) * 17); // Tint blue and set transparency image(img, 200, 200); }
Thank you so much for your reply, but when I do that, the whole screen and every image turns transparent. How do I set all the other images to full opacity, but my main image that I want to put that effect on, transparent?
-DeTjomas
For any change you want to do to one element or a selected element, like:
There are a few ways to do this. Here are two:
These have the same effect. popStyle automatically sets the tint back to whatever it was before you called pushStyle.
Answers
For reference on using opacity see the second example for the tint command: https://processing.org/reference/tint_.html
As for making the opacity pulse, how about using the system variable "frameCount" (https://processing.org/reference/frameCount.html) in your draw() loop. For example:
Thank you so much for your reply, but when I do that, the whole screen and every image turns transparent. How do I set all the other images to full opacity, but my main image that I want to put that effect on, transparent?
-DeTjomas
For any change you want to do to one element or a selected element, like:
There are a few ways to do this. Here are two:
These have the same effect. popStyle automatically sets the tint back to whatever it was before you called pushStyle.