r/FastLED • u/Benjilator • Mar 20 '24
Support Using blur function in a loop (last led to first led) - something similar to modulo operator?
I can’t seem to figure out a way to use the blur function in a loop.
My setup is simply a circle with a dot spinning around (easy to loop this with modulo operator).
Now I want this dot to be blurred using the blur function.
Now there’s a cut between the last and first led.
I’ve tried making the blur myself but since I’m not very advanced with coding I end up with something like “dot = brightness 100”, “dot+1 and dot-1 = brightness 80” etc, which bloats my code and also makes having multiple dots a lot harder to deal with.
I’ve tried going with adding and subtracting single colors and tried to make 3 randomly spinning dots blurry but it simply becomes too complicated and bloated.
Is there an easy way to make the blur function loop around similar to how I am using the modulo operator to loop values?
1
u/Preyy Ground Loops: Part of this balanced breakfast Mar 20 '24
Paste code
1
u/Marmilicious [Marc Miller] Mar 20 '24
There's a few ideas here you might be able to use.
https://www.reddit.com/r/FastLED/comments/18t1u8u/best_way_to_loop_effects_like_blur_around_a_ring/
Another idea might be to initially draw and blur your pixel in the middle of a temporary CRGB array, maybe 7 pixels long. Call it leds_temp[7] for example. Put some color data at position leds_temp[3], blur it, then copy the pixel data from leds_temp to leds (your main ring), offsetting over time as desired.
Please share a link to your code on pastebin.com or gist.github.com to show what you've been trying.
1
u/sutaburosu [stavros] Mar 21 '24
Here is a modified version of FastLED's blur1d function that you could copy into your own code and use instead. It's still not seamless, but it's a lot better.