We are about to switch to a new forum software. Until then we have removed the registration on this forum.
Hi everyone. I currently have inverted the colours of my image, however, when i put it in my sketch with the other functions, it only flashes many times, rather than actually changing gradually over 10 frames. I have set the frame rate to 10 frames, but put together with with my previous image transformation it will not work. How do I make it gradually transform over 10 frames?
The image is a colourful picture, 1280 x 720.
//Inverting image colour
void invertColor() {
background(img1);
image(img1,0,0);
for (int x = 0; x < img1.width; x++) {
for(int y = 0; y <img1.height;y++) {
color c = get(x,y);
img1.set(x,y, color(255-red(c), 255-green(c), 255-blue(c)));
}
}
}
I'm very new to this, so sorry if it's unclear or confusing :/ I can give more information if needed. Thank you.
Answers
Sounds normal to me. If you had a button light-on / light-off that you switch every 16 millisecond, it should blink too. That's exactly what you are doing
I dont have a button, and I dont want it to blink. I want it to gradually transform to inverted colour over time (from the original image)
By the way, please try to be a bit more polite when you ask help to unknown people...
It's not hard to start a message by "Hello" and to finish by "thank you for the help".
We are not robots yet. :|
I apologise that I sounded rude, that was not my intention at all :( I will keep it in mind for future posts and comments!
"I dont have a button, and I dont want it to blink. I want it to gradually transform to inverted colour over time (from the original image)"
I know... Try to understand what I want to say with my light-on/light-off button :)
hint : when you switch your button, you negate its previous value.
See my answer to blur image over 10 frames perhaps.