Blinkfade in Cube Frame

Here’s a quick-and-dirty PB port of the .INO…

delayFor = 5000;  //  How long before the pattern starts
displayFor = 200;     //  How long each LED stays lit

export var initialDelay = delayFor;
export var whichLED = 0;

totalTime = 0;
export function beforeRender(delta) { 
  if (initialDelay > 0) initialDelay -= delta;
  else {
    totalTime += delta; 
    if (totalTime > displayFor) {
      totalTime = 0;
      whichLED++;
      if (whichLED > pixelCount) {
        initialDelay = delayFor;
        whichLED = 0;
      }
    }
  }    
}

export function render(index) {
  if ((initialDelay < 0) && (index == whichLED)) rgb(1,1,1);
  else rgb(0,0,0);
}

EDIT: took a second look and noticed that the pattern repeats.

2 Likes