This is a simple project I wrote to test out an animation idea. It shows a simple, linear animation whose speed does not vary. It moves in a very robotic manner. Contrast that with a ‘smooth’ animation, using the cosine wave to adjust the speed. It starts slow, moves fastest in the middle, and then slows up toward the end. This animation is much more natural.
See it in action here.
I had the idea of using a cosine wave several years before ever coding it up. I never had all the math quite figured out. One night I realized I could slap something together in html/javascript fairly quickly, so I stayed up late, figured out the math, and got it working.