# How to loop animation and randomize position of points

In this learning experiment, I want to use a field to offset the positions of points in a grid and then put an instance on the points of the grid.

As I would like to animate this over time, I am using the frame number to drive some kind of change, though this probably isn't the right way to do this.

I want to loop the animation but rather than all the points starting off from 0 on the z axis I would like them to be separated a little more.

What should I look to change to make it loop and not start on 0 on z axis?

EDIT: Please ignore the sample index node, I forgot to remove it.

• we don't know exactly what you want to achieve in terms of effect, but you can play around calculating a modulo from the frame input. Commented Jan 26 at 9:41
• yeah I need to get better at explaining what I want to achieve
– Neil
Commented Jan 26 at 11:54

Start randomized and loop you will get by e.g. this node tree:

But of course there are many ways to do that.

Explanation: The first set position node creates the initial state of the cubes via the noise texture node, so that they don't start all at the same z value. This works because Blender automatically plugs in the position vector into the vector input of the noise texture (and every different position produces a different output value). The second set position node uses just the offset so that we don't loose our initial z value from the node before. The scene time will be used to drive the map range node, so without the add and multiply node, you can say: from frame 1 to 100 we got one loop because the output of the loop is zero to tau (2 times pi) which produces a full "circle"/wave length of the sine wave from 0 to 0. The add, random and multiply node do just add randomness and adapt the speed.

• Thank you Chris. So is it the map range node using the input frame range and outputting 0 - tau that is creating the loop?
– Neil
Commented Jan 26 at 11:55
• actually no, it is the sin node, because it produces values from 0 to 1. I just use the map range node so that you can easily calculate the frame range to the loop start/end. Commented Jan 26 at 12:37
• the map range node with these values with unchecked clamp just will increase its value to infinity. Commented Jan 26 at 12:38