Helloooo I’m back with another question😊.
This time it’s about the tint function.
I like being able to set the tint to random but it moves very fast, is there any way to slow down the tint speed? I think I heard somewhere that the speed Processing uses is 60fps, Could that be slowed down? Or is that going to slow the whole code down? Is it possible to just slow down the tint speed and how could I do that?
I hope someone had an answer for me.
// Make sure RGB is within range
rtotal = constrain(rtotal, random (200),255);
gtotal = constrain(gtotal, random (200),255);
btotal = constrain(btotal, random (225),255);
It’s part of the convolution example on the processing.org site. I set the tint of the square to random and it does what I want to do, but the colours are moving very fast and I would like it to be slower.
And maybe you have an idea on how to change the size and shape of the square?
Hm, I don’t think I understand your code question. But for this specific question you’re in luck; you can set the max frame rate of a sketch with the
frameRate(24) method. In addition, if you call it without any parameters, it serves as a getter.
Loot a the code in the example and start to investigate and tinker with each variable:
// Calculate the small rectangle we will process
int xstart = constrain(mouseX - w/2, 0, img.width);
int ystart = constrain(mouseY - w/2, 0, img.height);
int xend = constrain(mouseX + w/2, 0, img.width);
int yend = constrain(mouseY + w/2, 0, img.height);
One of the best tools in a programmer’s tool chest is knowing the resources available to you and learning to navigate, filter, and use them.
A short list of resources to peruse:
Resources < Click here to expand !
Explore the resources available here: