예제 #1
0
        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;
        }
예제 #2
0
파일: Edge.cs 프로젝트: golf1052/TheBox
 public void Update()
 {
     strip.SendPixels();
 }