Each of these swinging balls is a pendulum that swings back and forth at a slightly different rate, determined by the length of string supporting it.
The longest pendulum swings back and forth exactly 15 times in 30 seconds. Its neighbor swings 16 times in 30 seconds, the next 17, and so on down to the shortest one, which swings exactly 24 times in 30 seconds. Since every pendulum completes a whole number of swings in 30 seconds, they all come back together every 30 seconds.
After 15 seconds, the even-numbered pendulums have completed a whole number of swings and are back where they started. The odd-numbered pendulums are exactly halfway through one of their swings and are opposite where they started. The result is two opposing lines of pendulums that seem to dance with each other.