How could I make sway like this?

I don’t know why, but it seems to do the same exact thing.

Doesn’t seem to do it when you put the sway through a spring. Although, I don’t want try to use one.