Cycling / looping through a set of index values using geometry nodes to create animation.

Since they are still working on adding loops in geometry nodes how would I cycle through a set of indexes to produce an animation using geometry nodes?


  1. Index group/values to loop/cycle through (2,5,8,11,14)

My thoughts where:

  1. Use #frame (to animate blinking lights on/off)
  2. To use a modulo (to loop/cycle through index group)

I'm not sure how to tie the #frame and modulo loop in to create the animation.

See example frames below of looping animation wanted.

Frame 1 im1

Frame 2


Frame 3


Frame 4


Frame 5




See Attached file:


3 Answers 3


add this to your node setup:

enter image description here

It just compares the result of the module (which is 0,1,2,3,4) to the frame and then assign the value via the switch node.


enter image description here


To remain flexible, you should rather solve this task like this:

enter image description here

Here you simply define the number of rows and columns, and additionally select the row in which the lights should be switched on and off.

This is then done with few nodes, and is simply solved with logic.

You can build the scenery even simpler.

Instead of instantiating the lines on the circles, do it the other way around:

enter image description here

Because then you could actually make the selection even simpler.

  • $\begingroup$ +1, though this changes the output (which doesn't matter if the joins performed by OP were done only for debugging purposes), and it only works for the example, while not for the question in general (though the OP hinted this is XY problem by mentioning the modulo...) $\endgroup$ Sep 16, 2022 at 14:19

If you have at most 31 states, you can use a color ramp to translate frame number to index:

The colors of the color ramp are not important, the important part is color swatch positions, and the alpha values:

  • Since swatch positions can't be larger than 1, I divide the frame by 10, so that frame #3 becomes 0.3, which can be stored as a swatch position (keep in mind that frame #15 / 10 = 1.1, which can't be stored as a swatch position, so if you have 10 or more frames, divide by 100 instead). I also add a very small number to be sure I end up to the right of the corresponding swatch.
  • Since the alpha value can be larger than 1, I just set the index as the alpha value.

So the swatches in this color ramp are:

  • 0.1: alpha = 2
  • 0.2: alpha = 5
  • 0.3: alpha = 8
  • 0.4: alpha = 11
  • 0.5: alpha = 14

Finally I explicitly convert the outcome of the translation to integer to be sure the float inaccuracies don't bite me, then check against currently evaluated index and implicitly convert the false/true boolean to 0/1 integer which is the instance index in the supplied collection.

If you have more than 31 states, use a separate object which is a line of vertices, where each vertex index corresponds to frame number, and Z position corresponds to the index of the instance that should be lit. See this technique in How to instantiate objects on individual/selected points in geometry nodes?


You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .