This module provides effects based on the [WS2812 library](ws2812.md). Some effects are inspired by / based on the [WS2812FX Library](https://github.com/kitesurfer1404/WS2812FX) but have been adopted to the specifics of the ws2812 library. The effects library works based on a buffer created through the ws2812 library and performs the operations on this buffer.
This module depends on the [color utils module](color-utils.md) and [pixbuf module](pixbuf.md). Things **will** fail if those modules are missing in the firmware!
`delay` is the current effect delay in milliseconds
## ws2812_effects.set_mode()
Set the active effect mode.
#### Syntax
`ws2812_effects.set_mode(mode, [effect_param])`
#### Parameters
-`mode` is the effect mode as a string, can be one of
-`static` fills the buffer with the color set through `ws2812_effects.set_color()`
-`blink` fills the buffer with the color set through `ws2812_effects.set_color()` and starts blinking
-`gradient` fills the buffer with a gradient defined by the color values provided with the `effect_param`. This parameter must be a string containing the color values with same pixel size as the current buffer configuration. Minimum two colors must be provided. If more are provided, the strip is split in equal parts and the colors are used as intermediate colors. The gradient is calculated based on HSV color space, so no greyscale colors are supported as those cannot be converted to HSV.
-`gradient_rgb` similar to `gradient` but uses simple RGB value interpolation instead of conversions to the HSV color space.
-`random_color` fills the buffer completely with a random color and changes this color constantly
-`rainbow` animates through the full color spectrum, with the entire strip having the same color
-`rainbow_cycle` fills the buffer with a rainbow gradient. The optional second parameter states the number of repetitions (integer).
-`flicker` fills the buffer with the color set through `ws2812_effects.set_color()` and begins random flickering of pixels with a maximum flicker amount defined by the second parameter (integer, e.g. 50 to flicker with 50/255 of the color)
-`fire` is a fire flickering effect
-`fire_soft` is a soft fire flickering effect
-`fire_intense` is an intense fire flickering effect
-`halloween` fills the strip with purple and orange pixels and circles them
-`circus_combustus` fills the strip with red/white/black pixels and circles them
-`larson_scanner` is the K.I.T.T. scanner effect, based on the color set through `ws2812_effects.set_color()`
-`color_wipe` fills the strip pixel by pixel with the color set through `ws2812_effects.set_color()` and then starts turning pixels off again from beginning to end.
-`random_dot` sets random dots to the color set through `ws2812_effects.set_color()` and fades them out again
-`cycle` takes the buffer as-is and cycles it. With the second parameter it can be defined how many pixels the shift will be. Negative values shift to opposite direction.
-`effect_param` is an optional effect parameter. See the effect modes for further explanations. It can be an integer value or a string.
#### Returns
`nil`
#### Examples
Full initialization code for the strip, a buffer and the effect library can be found at top of this documentation. Only effect examples are shown here.