This is a small app demonstrating how to produce an SDF in WebGL by rendering very wide lines and writing distance to the depth buffer.
Here you can see what happens when the depth test is turned off...
...and try changing the line width.
Finally, this control toggles a triangle-by-triangle animation showing each line segment's contribution to the result. Note that the animation is for illustration purposes only -- the lines can all be rendered together in a single draw call.