beforeRender(delta) Question

The beforeRender function is called just before an entire frame of color information is sent to the pixel strip and the delta is the elapsed time sent it was last called. Is a frame one pixel or the entire strip of pixels? I just want to get clarification on whether or not the beforeRender function is called before the color information is sent to each pixel or sent to the entire strip of pixels? Thanks,

Hi! It’s called once between updates for the whole strip (a “frame” is the entire strip). Code you need to compute before each pixel can just be placed in render().

1 Like

Excellent. Thank you.

I am seeing values for delta of like 8.678456 how do we figure out what the unit is?

To answer my own question… According to the PB docs…

The exported beforeRender(delta) function is called before it is going to render a new frame of pixels to the strip. The delta argument is the number of elapsed milliseconds (with a resolution of 6.25ns!) since the last time beforeRender was called. You can use delta to create animations that run at the same speed regardless of the frame rate.

1 Like