# Move object along a list of objects in Animation Nodes

I have a list of objects and I want to move an object along the path connecting each two consecutive object in the list, where the object takes one second to move in each path.

Currently, I have this node tree that only moves the object between two cubes, I want to extend it to work with a list of objects.

First of all, we add our objects to a group and get them using the Objects From Group Node, we can then optionally sort them in whatever way we think it fits, in this case, I sorted them by name. The time of the Animate Node should maintain its range, that is, if the objects takes one second to move between the two objects (24 frames assuming the fps is 24), then the time should maintain that range and goes back to zero as it exceeds it, this can be done using the modulo operation. All we have to do now is find the two objects that we will use for the start and end points, it is obvious that if the start object has the index i, then the end will have an index i+1, so the problem reduces to finding i. i is zero at the first 24 frames, 1 at the next 24 frames, 2 at the next 24 frames and so on, this pattern can be generated using the floor division operator. By implementing that, we get the needed animation: