WalkingMotion is a class library that generates 2D pseudo human walking motion by a combination of a couple of trigonometric functions. It is written for Processing, but it would be easy to port it to other languages.
The library also provides a running motion too.
Powered by Processing and Processing.js.