Creating values for a fade

Hi @keys,

I think the key here is to see that tick and a given ring are very separate things. tick is a thread-local counter. Every time you call it, it will add 1 to the current counter value. If you call it 1000 times, the counter value will be 1000 (actually 999 as the counting starts at 0, but I’m just mentioning that here for technical completeness).

Calling .look on a ring will use the current counter value as an index on the ring and if the value is larger than the size of the ring (say the ring has only 15 elements within it) it will wrap the index round back to the beginning (using a mod of the ring’s size) so that it always returns a value within the ring. (That’s why rings are called rings - they act like ring buffers).

Therefore, if you call .look on a new ring, it will still use the counter value as it currently stands. Each ring does not have its own distinct counter.

If you want to reset a counter call tick_reset and then you’ll be back where you started :slight_smile:

Hope that this helps

2 Likes