Smooth animation/interpolation

I recommend you check out autonomous behaviour videos by the coding train. The code is written in p5js but the logic is the same in processing. This is the final video you “have” to watch:

Here is the first video:

Try to implement this sort of thing. I hope you find this helpful.