kitesurfer1404 / WS2812FX

WS2812 FX Library for Arduino and ESP8266

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

How to lengthen the Comet-Tail?

EherXtrem opened this issue · comments

I would like to lengthen the tail of the Comet (#44) effect a bit. Is that possible and if so, how?

You can use the optional OPTIONS parameter to control the length of the comet tail. One of the options is FADE_RATE which controls how long it takes to fade the comet tail, and so its length.

If you specify NO_OPTIONS (or just leave off the options parameter), you get the default fade rate, which always fades to black:

ws2812fx.setSegment(0,  0,  LED_COUNT - 1, FX_MODE_COMET, BLUE, 5000, NO_OPTIONS);

There are seven other FADE_RATE options, which make the fade rate faster or slower, and so the comet tail shorter or longer:

FADE_XFAST
FADE_FAST
FADE_MEDIUM
FADE_SLOW
FADE_XSLOW
FADE_XXSLOW
FADE_GLACIAL
ws2812fx.setSegment(0,  0,  LED_COUNT - 1, FX_MODE_COMET, BLUE, 5000, FADE_XSLOW);

Note that when you use one of the seven optional fade rates, it enables you to also fade to a background color other than black. So if you wanted a blue comet on a red background you can do this:

ws2812fx.setSegment(0,  0,  LED_COUNT - 1, FX_MODE_COMET, COLORS(BLUE, DIM(RED)), 5000, FADE_XSLOW);

There's more info about the OPTIONS parameter in the users guide.

Wow ! It works preaty nice ! THX a lot !

Now I will try to discover the options for Fireworks Random (#46) by my own :)

You're welcome. Good luck!

Is there a backgroud color option instead of black in Fireworks Random mode too?

You can use a fade option to get a non-black background color even with the FIREWORKS_RANDOM effect. This works for me:

  ws2812fx.setSegment(0,  0, LED_COUNT - 1, FX_MODE_FIREWORKS_RANDOM, COLORS(BLUE, DARK(RED)), 1000, FADE_MEDIUM);

It gets a little tricky with FIREWORKS_RANDOM (and other effects) if you slow down the fade too much. The background color can easily wash out the effect if the LEDs fade too slowly. For best effect set the brightness to 255 and set the background color to something very dim to produce good contrast. If you want bigger fireworks, you can combine a FADE and SIZE option like so:

ws2812fx.setSegment(0,  0, LED_COUNT - 1, FX_MODE_FIREWORKS_RANDOM, COLORS(BLUE, DARK(RED)), 1000, (uint8_t)(FADE_MEDIUM | SIZE_LARGE));

Big THX - both code lines work very well. Awesome support :)