Hi everyone! 2d matrix effects are a nice thing to code - but this requires lots of physical leds and a strong power supply to feed them.

So why not creating a 2d effect with just a very small amout of leds?

Here is the idea: Imagine a virtual 256x256 matrix. And imagine a circle constisting of NUM_LEDS leds. Now place this circle on the virtual matrix. The circle can be mathematically described as 2 overlapping functions - a sinus on x and a cosinus wave on y. The angle position of every single led we know - assuming the circle consists of 256 angle units the absolute x/y position defined by the relative angle of the given led is uint8_t angle = (i * 255) / NUM_LEDS;

So long story short - my code does the following: Calculate one time a look up table which contains the x/y position of any led within the virtual 256x256 matrix. This allows to calculate the noise data only for the few positions we really need = it´s fast while it still has the precision of a high-res matrix.

Based on that it´s easy to move the noise field in any direction(s).

The code contains 3 independent examples: example_1 moves the content up and down while shifting it slowly to the side. example_2 moves just along one axis and example_3 moves along the z axis of the noise space. Of course this simple movements can be combined or described by more complex functions, or they could be controlled by audio or sensor data or anything else you can imagine.

The color mapping could be improved as well - I decided to use a simple HSV mapping in order to keep the code simple and easy readable for the beginning.

The code is meant to inspire you to play with it yourself and create nice animations even for a limited setup. That´s why I kept the code short. It´s about the idea and not so mutch about delivering a plug and play animation.

Questions, suggestions and comments are highly appreciated. Has the code enough comments to get the idea? Is it useful for you?

Today was crazy busy and I hope to have a look at your routine(s) over the next few days. . . .

Update: Cool. I’ve now converted that to palette lookup with smooth transitioning to a new one every 5 seconds and trying out mathematical variations of each of the variables.

Thanks, everyone! The laste time I played with this idea was already 2 years ago with only 32 leds in the circle. Back then I calculated the whole matrix data and picked afterwards the little data I really needed for the circle. Here the link to the post: https://plus.google.com/115124694226931502095/posts/YxazKtMd31M

Could this be done inverted with an outer facing and inner facing ring to double the size? granted there would be a thin circle in the middle of the field.

this is exactly what i needed to kick off the lighting for my halloween mask!! excellent work. as an aside, you can work with specific palettes by using:
CRGB color = ColorFromPalette( paletteVariable, index, bri);

Could you walk me through the gist of this, maybe with a picture of your virtual matrix/functions? So the idea is that from some position on the circle you can re-create the effect of a square matrix? I’m not sure I follow, exactly but it’s interesting!

The idea is to use angular coordinates to create the same complex effects that would be a lot more challenging if using x/y – is that the gist?

@John_Hendy : Yes, the polar coordinates of the leds are transformed into x/y coordinates.
FastLED noise functions calculate a noise value for a given x/y/z value. So if the precalculated leds x/y coordinates are fed into the noise function the visible effect is basically the same as it would be on a 2 dimensional matrix - just with way less leds. Does that help?