Using sine and cosine.
A little animation I made based on a gif I found that I thought would be fun to recreate.