This is one of the activities that I did when taking a Processing JS class on Khan Academy.  In this project I learned how to track the mouse and draw a line from a static point to a moving point (the mouse).