# "Spiral twirls" 2D matrix effect

I’ve just uploaded a pattern called “2D Spiral Twirls” that can be customised to create a variety of spiralling/rotating/twirling effects.

For best results you probably want a matrix that’s 16x16 or higher. I’d suggest starting with all the sliders to the far left, then try them out one by one to see what impact each one has on the overall pattern.

If you’re after a more colorful rainbow effect then change the line:

``````setColor(angle, rotation, dist)
``````

to

``````hsv(angle * arms - rotation, 1, 1.01 - dist)
``````

also, if you want to fill in the whole matrix rather than keep the pattern constrained to a circle then change

``````  v = (1.01 - dist) * (h < 0.5 ? h * h * h : h)
``````

to

``````  v = h < 0.5 ? h * h * h : h
``````

Let me know if you have any questions or suggestions!

2 Likes

Really nice! Easy to follow, clean code.

For anyone who doesn’t have a matrix handy and wants to see what this looks like, here it is configured with moderate speeds and 2 arms:

3 Likes

Thanks for trying this and providing a video Jeff. I was going to upload a video myself but if you saw the state of my “matrix” you’d understand why I’m a bit reluctant to - it’s basically just a tangle of wires and LED strips at present, and a bit of a pain to take a clear video of. Your one looks much better

The plan is to put what I have onto a costume once I’ve coded up a few more patterns at which point it might look a bit more presentable!

1 Like

I needed to change that one value to be slightly more than 1.01, to get it to work with the outermost ring of my circular led matrix, otherwise it never turned them on.

`````` v = (1.01 - dist) * (h < 0.5 ? h * h * h : h)
``````

even as little as 1.05 started to use those… 1.1 was a good value.

Actually Jeff’s square matrix video shows the same, the outside ‘row’ all the way around isn’t really used, so I’d say adjust to taste.