This example illustrates this GeoExamples blog entry.
The map shows the track of the Hayian typhoon, that hit Phillipines on November 2013.
The gradient code is taken from Mike Bostock’s example Gradient Along Stroke