Another way to try this if you're interested:
I ended up working on this by creating a loop to draw a couple of hundred line segments, and changing the line width accordingly during the drawing cycle.
To adjust the line width, I used the following function: MAX_WIDTH * sinf (M_PI * (i / NUMBER_OF_SEGMENTS)
It looks great and no performance issues as far as I can tell. It worked especially well, because I already had a list of points to use on the curve. In other cases, I suggest that it would be better to use the sosborn method.
source share