async Task RainbowTest(float average) { runningIdleAnimation = true; while (Idle) { for (int j = 0; j < rainbow.Length; j++) { for (int i = 0; i < leftStrip.PixelCount; i++) { Color color = HexToRgb(rainbow[(i + j) % rainbow.Length]); color.A = (byte)Brightness; leftStrip.strip[i] = color; rightStrip.strip[i] = color; } leftStrip.SendPixels(); rightStrip.SendPixels(); await Task.Delay(TimeSpan.FromMilliseconds(rainbowSpeed)); if (!rainbowGoingDown) { rainbowSpeed++; } else { rainbowSpeed--; } if (rainbowSpeed <= rainbowMin) { rainbowGoingDown = false; rainbowSpeed = rainbowMin; } else if (rainbowSpeed >= rainbowMax) { rainbowGoingDown = true; rainbowSpeed = rainbowMax; } if (!CheckForIdle(average)) { break; } ChangeIdleMode(); if (idleMode != IdleModes.Rainbow) { break; } } } runningIdleAnimation = false; }
public void Update() { strip.SendPixels(); }