folkertdev / svg-path-lowlevel / Path.LowLevel.Parser

Parse SVG path syntax into an elm value

parse : String -> Result (List (Parser.Advanced.DeadEnd String String)) (List Path.LowLevel.SubPath)

Parse svg path syntax into a list of subpaths.

parse "m10,20 A25,25 -30 0,1 50,-25"
    -->
    Ok
    [ { moveto = MoveTo Relative ( 10, 20 )
      , drawtos =
            [ EllipticalArc Absolute
                { radii = ( 25, 25 )
                , xAxisRotate = -30
                , arcFlag = SmallestArc
                , direction = CounterClockwise
                , target = ( 50, -25 )
                }
            ]
      }
    ]