How can I make data persist?

I’m trying to simulate something that I thought would be easy: a circular string of individually addressable LEDs changing in response to position data from a ball plotting a path inside the LED ring:

The goal is for the LEDs’ changing colors to follow the ball’s position - in this case, as the ball passes by the LED that matches its Theta position, it updates that LED’s prior color to a new one which persists until the ball passes by again. My problem is that I can’t figure out how to make each update to the LEDs colors persist. I’m pretty sure I’m missing something obvious - it seems like using the data recorder component would be one way, but it seems no matter how I approach it, I end up failing. Here’s a very simple example (my other several failed definitions are embarrassingly complicated and messy).
data recorder3.gh (14.7 KB)
I also tried to approach this by scripting, but evidently I don’t have enough elementary knowledge of C# to properly create an array :flushed:. Any guidance would be greatly appreciated!

Hello there!

With Data recorderer you can achieve something, but it’s a bit tricky.
Setting it with a “Record limit = 1” it means it will forget the old value as soon as you give it a new one.
But working with a tree lets you use that logic separately for every branch of the tree:

recorderer

data recorder 4.gh (16.5 KB)

c# is more flexible…

2 Likes

Great thanks @maje90 ! Your definition provided the clues I needed.

Still hoping for a bare bones C# example from you or another kind soul :slight_smile:



Recordin colors v0.1.gh (12.4 KB)

1 Like

Whoa. So elegant in its concision. Deep thanks and respect.