In your beforeRender() function: @jeff’s suggestions are good ones.
Near the line theLitPixel=floor(random(pixelCount))
, you have is the right idea. You’re selecting the pixel you want to light at frame time. Thing is, unless it’s controlled by your timer, ( if (plusDelta > 3200)...
), it will select a new pixel on every frame.
This is what curly braces are all about - they’re just a general purpose mechanism for marking off functional blocks of code. So if you set that piece of code up like this:
if (plusDelta > 3200) {
plusDelta = 0 // Max total cycle is 3,200 Ms, randomized
theLitPixel=floor(random(pixelCount))
hue = random(1)
sat = random(1)
v = random(1)
v=pow(v,2.5)
}
all the code between {
and }
will only be executed every 3.2 seconds, which will give you the timing control you’re looking for.