Namespace ColorEffects
The ColorEffects
namespace provides utility functions for generating dynamic lighting effects such as rainbow, breathing, strobe, and other color modulation effects based on time and phase offsets.
The source file for those utilities are located in os/framework/ColorEffects.h
ColorEffect::Rainbow
Color Rainbow(uint16_t period = 1000, int32_t offset = 0);
Generates a rainbow color effect that cycles through the hue spectrum over the specified period.
Parameters:
period
(uint16_t
, optional): The duration of the full color cycle in milliseconds. Defaults to1000ms
.offset
(int32_t
, optional): An offset to adjust the starting hue. Defaults to0
.
Returns:
Color
: The current color in the rainbow cycle.
ColorEffect::Breath
uint8_t Breath(uint16_t period = 1000, int32_t offset = 0);
Generates a brightness value that smoothly transitions in a sinusoidal pattern (breathing effect).
Parameters:
period
(uint16_t
, optional): The duration of the breathing cycle in milliseconds. Defaults to1000ms
.offset
(int32_t
, optional): An offset to adjust the breathing phase. Defaults to0
.
Returns:
uint8_t
: The brightness value (0-255).
ColorEffect::ColorBreath
Color ColorBreath(Color color, uint16_t period = 1000, int32_t offset = 0);
Applies a breathing effect to a specific color by modulating its brightness.
Parameters:
color
(Color
): The base color.period
(uint16_t
, optional): The duration of the breathing cycle in milliseconds. Defaults to1000ms
.offset
(int32_t
, optional): An offset to adjust the breathing phase. Defaults to0
.
Returns:
Color
: The modulated color with the breathing effect applied.
ColorEffect::BreathLowBound
uint8_t BreathLowBound(uint8_t lowBound = 32, uint16_t period = 1000, int32_t offset = 0);
Generates a breathing effect with a minimum brightness value.
Parameters:
lowBound
(uint8_t
, optional): The minimum brightness value. Defaults to32
.period
(uint16_t
, optional): The duration of the breathing cycle in milliseconds. Defaults to1000ms
.offset
(int32_t
, optional): An offset to adjust the breathing phase. Defaults to0
.
Returns:
uint8_t
: The brightness value (0-255).
ColorEffect::ColorBreathLowBound
Color ColorBreathLowBound(Color color, uint8_t lowBound = 64, uint16_t period = 1000, int32_t offset = 0);
Applies a breathing effect to a color, ensuring a minimum brightness value.
Parameters:
color
(Color
): The base color.lowBound
(uint8_t
, optional): The minimum brightness value. Defaults to64
.period
(uint16_t
, optional): The duration of the breathing cycle in milliseconds. Defaults to1000ms
.offset
(int32_t
, optional): An offset to adjust the breathing phase. Defaults to0
.
Returns:
Color
: The modulated color with the breathing effect applied.