It is not a shortcut, this is how almost every animation works.
You start by cleaning everything you have on your screen at the begining of draw() with
background(color);
Then you update the position of your objects.
Then you draw your objects (at their new position).
I remember there was a thread quite similar to what you are asking. I’ll have a look and paste it here.
Edit:
This is the thread: Draw lines that go from bottom to top? - #4 by jb4x