sum var accumulates the length of the pattern.
For example, on a line with a pattern of
[10,10], the pattern will take 20 points to draw itself out (i.e.
10 + 10 or the sum of all the values in the pattern array).
In the example above, we are calculating the pattern where the dash lengths increase with gaps always equal to
So, to animate through the entire pattern we calculate the length / sum of the pattern.