Here’s what I’d do:
Make a cube, give it a bunch of loop cuts, use a curve modifier targeting a bezier circle, animate the cube’s x-scale.
Curve modifiers can be tricky, read up on them if you haven’t used them before. (Be meticulous about origin of both the curve and the object getting the modifier.)