Lines 42 - 49 in the Intro to Pixelblaze Code pattern read as follows -
export function render(index) {
red = green = blue = 0
leadPosition = time(0.08) * pixelCount
red = abs(leadPosition - index - 0) < 1
green = abs(leadPosition - index - 4) < 1
blue = abs(leadPosition - index - 8) < 1
rgb(red, green, blue)
}
I get the general drift, and its cool, but I am still puzzled be the following -
The code above lights two pixels for each color… not sure how the code this works (lighting two each as written) unless things go both negative and positive (?), hence or from the “abs”.
The < sign controls/limits the number of pixels lit for each color, but how?
I’d think we would need a “floor” command somewhere…why don’t we need a “floor” command?
It would be great if greater minds helped elucidate these mysteries for me.
Yup, that was key! Still getting used to waveforms as timers…
Just idly wondering if this is a computationally-costly way to move pixels around.
I’d leave the floor out because… as y’all say, “golfing”!
Thanks!