A demo using Smooth.js and HTML5 canvas to draw a curve through a set of points. See this blog post for further discussion. You can also see the CoffeeScript source. Drag the points below to move them. Double click to add/remove points. The meat of the actual curve drawing is in the addCurveSegment function, which samples the output of Smooth.js to create line segments approximating the function.