support for template GetPixelColor method (#774)

This commit is contained in:
Michael Miller authored and GitHub committed 2024-02-29 14:20:20 -08:00
1 parent 1a715a56b8
commit 99b6db904b
7 files changed
+80 -5

No files matched your search

@@ -139,7 +139,7 @@ void SetupAnimationSet()
uint16_t time = random(100, 400);
// each animation starts with the color that was present
RgbColor originalColor = strip.GetPixelColor(pixel);
RgbColor originalColor = strip.GetPixelColor<RgbColor>(pixel);
// and ends with a random color
RgbColor targetColor = RgbColor(random(peak), random(peak), random(peak));
// with the random ease function
@@ -40,7 +40,7 @@ void FadeAll(uint8_t darkenBy)
RgbColor color;
for (uint16_t indexPixel = 0; indexPixel < strip.PixelCount(); indexPixel++)
{
color = strip.GetPixelColor(indexPixel);
color = strip.GetPixelColor<RgbColor>(indexPixel);
color.Darken(darkenBy);
strip.SetPixelColor(indexPixel, color);
}
@@ -82,7 +82,7 @@ void FadeInFadeOutRinseRepeat(float luminance)
RgbColor target = HslColor(random(360) / 360.0f, 1.0f, luminance);
uint16_t time = random(800, 2000);
animationState[0].StartingColor = strip.GetPixelColor(0);
animationState[0].StartingColor = strip.GetPixelColor<RgbColor>(0);
animationState[0].EndingColor = target;
animations.StartAnimation(0, time, BlendAnimUpdate);
@@ -92,7 +92,7 @@ void FadeInFadeOutRinseRepeat(float luminance)
// fade to black
uint16_t time = random(600, 700);
animationState[0].StartingColor = strip.GetPixelColor(0);
animationState[0].StartingColor = strip.GetPixelColor<RgbColor>(0);
animationState[0].EndingColor = RgbColor(0);
animations.StartAnimation(0, time, BlendAnimUpdate);
@@ -76,7 +76,7 @@ void PickRandom(float luminance)
// we use HslColor object as it allows us to easily pick a color
// with the same saturation and luminance
uint16_t time = random(100, 400);
animationState[pixel].StartingColor = strip.GetPixelColor(pixel);
animationState[pixel].StartingColor = strip.GetPixelColor<RgbColor>(pixel);
animationState[pixel].EndingColor = HslColor(random(360) / 360.0f, 1.0f, luminance);
animations.StartAnimation(pixel, time, BlendAnimUpdate);