Animation layers

here is how to draw moving line take an idea

Bouncing line with for loops