Animated drawing of a Bézier curve Your job is to draw a Bézier curve given it's control points. The only criteria is that you actually have to show how to draw the curve from the initial control point to the last one.

Criterias


The result has to be animated, e.g. it has to show the drawing process somehow. The way you do the animation is irrelevant, it can generate a .gif, it can draw to a window, or generate ASCII results (and possibly clearing the screen after each draw), etc.
It has to support at least 64 control points.
This is a popularity contest, so you might want to add some additional features to your program to get more upvotes. (My answer for example draws the control points, and some visual aid on how to generate the image as well)
The winner is the most upvoted valid answer 7 days after the last valid submission.
My submission doesn't count as valid.


How to draw a Bézier curve

Assume we want to draw 100 iterations. To get the nth point of the curve you can use the following algorithm:

1. Take each adjanced control point, and draw a line between them
2. Divide this line by the number of iterations, and get the nth point based on this division.
3. Put the points you've got into a separate list. Let's call them "secondary" control points.
4. Repeat the whole process, but use these new "secondary" control points. As these points have one less points at each iteration eventually only one point will remain, and you can end the loop.
5. This will be nth point of the Bézier curve


This might be a bit hard to understand when written down, so here are some images to help visualize it:

For two control points (shown in black dots) you only have one line initally (the black line). Dividing this line by the number of iterations and getting the nth point will result in the next point of the curve (shown in red):



For three control points, you first have to divide the line between the first and the second control point, then divide the line between the second and third control point. You will get the points marked with blue dots.

Then, as you still have two points, you have to draw a line between these two points (blue in the image), and divide them again to get the next point for the curve:



As you add more control points the algorithm stays the same, but there will be more and more iterations to do. Here is how it would look like with four points:



And five points:



You can also check my solution, which was used to generate these images, or read more about generating Bézier curves at Wikipedia
Done recursively in Mathematica with no hard limits on the number control points in just three lines:

ctrlPts = {{0, 0}, {1, 1}, {2, 0}, {1, -1}, {0, 0}};
getLines[x_List] := Partition[x, 2, 1];
partLine[{a_, b_}, t_] := t a + (1 - t) b;
f[pts_, t_] := NestList[partLine[#, t] &amp; /@ getLines@# &amp;, pts, Length@pts- 1]


Showing it is more involved than the calculations!:

color[x_] := ColorData[5, "ColorList"][[x[[1]]]]
Animate[Graphics[{PointSize[.03], ,
        MapIndexed[{color@#2, Point/@ #1,Line@#1} &amp;, f[ctrlPts,t]],
        Red, Point@Last@f[ctrlPts, t],
        Line@Flatten[(Last@f[ctrlPts, #]) &amp; /@ Range[0, t, 1/50], 1]}], {t, 0, 1}]


Code dissection (kind of) for the calc part:

getLines[x_List] := Partition[x, 2, 1]; (* Takes a list of points { pt1, pt2, pt...} 
                                           as input and returns {{pt1,pt2}, {pt2,pt3} ...}
                                           which are the endpoints for the successive
                                           lines between the input points *)

partLine[{a_, b_}, t_] := t a + (1 - t) b;(* Takes two points and a "time" as input 
                                             and calculates
                                             a linear interpolation between them*)

f[pts_, t_] := NestList[partLine[#, t] &amp; /@ getLines@# &amp;, pts, Length@pts- 1]
                                          (* This is where the meat is :) 
     Takes a list of n points and a "time" as input.
     Operates recursively on the previous result n-1 times, preserving all the results 
     Each time it does the following with the list {pt1, pt2, pt3 ...} received:
           1) Generates a list {{pt1, pt2}, {pt2, pt3}, {pt3, pt4} ...}
           2) For each of those sublists calculate the linear interpolation at time "t",
              thus effectively reducing the number of input points by 1 in each round.
     So the end result is a list of lists resembling:
     {{pt1, pt2, pt3 ...}, {t*pt1+(1-t)*pt2, t*pt2+(1-t)*pt3,..}, {t*pt12+(1-t)*pt23, ..},..}
                             --------------   ---------------         
                                  pt12              pt23
     And all those are the points you see in the following image:




With a few more lines you can drag the control points interactively while the animation is running:

Manipulate[
 Animate[Graphics[{
    PointSize[.03], Point@pts,
    MapIndexed[{color@#2, Point /@ #1, Line@#1} &amp;, f[pts, t]],
    Red, Point@Last@f[pts, t], Line@Flatten[(Last@f[pts, #]) &amp; /@ Range[0, t, 1/50], 1]}, 
   PlotRange -&gt; {{0, 2}, {-1, 1}}], {t, 0, 1}],
  {{pts, ctrlPts}, Locator}]


Here dragging the green point:  



BTW, the same code runs in 3D without modifications (For the Mathematica geeks you only have to replace Graphics[] by Graphics3D[] and add a third coordinate to the control points list):



NB:

Of course this kludge isn't needed in Mathematica as there are several primitives for drawing Beziers:

Graphics[{BSplineCurve[ctrlPts], Green, Line[ctrlPts], Red,  Point[ctrlPts]}]