Orasund/elm-svg-writer/1.1.0

NOTE: the latest version is 2.0.1

Svg.Path

Building Paths

type Path
= JumpTo ( Float, Float ) Path
| LineTo ( Float, Float ) Path
| ArcTo
( Float, Float )
{ radiusX : Float
, radiusY : Float
, rotation : Float
, takeTheLongWay : Bool
, clockwise : Bool
}
| Custom String Path
| EndClosed
| End

Commands for writing Paths.

You might want to use PathBuilder to build paths.

startAt : ( Float, Float ) -> PathBuilder

start building a path

end : PathBuilder -> Path

end the path

endClosed : PathBuilder -> Path

move back to the start and end the path

drawLineBy : ( Float, Float ) -> PathBuilder -> PathBuilder

draw a line to a relative point

drawLineTo : ( Float, Float ) -> PathBuilder -> PathBuilder

draw a line to a point

( Float, Float )
-> { angle : Float
, clockwise : Bool
}
-> PathBuilder
-> PathBuilder

Draw a circle arc around a center point

( Float, Float )
-> { angle : Float
, clockwise : Bool
}
-> PathBuilder
-> PathBuilder

draw a circle arc around a relative center

jumpBy : ( Float, Float ) -> PathBuilder -> PathBuilder

jump by a relative amount (without drawing)

jumpTo : ( Float, Float ) -> PathBuilder -> PathBuilder

jump to a point (without drawing)

Advanced

( Float, Float )
-> { radiusX : Float
, radiusY : Float
, rotation : Float
, takeTheLongWay : Bool
, clockwise : Bool
}
-> PathBuilder
-> PathBuilder

draw an arc to a relative point

( Float, Float )
-> { radiusX : Float
, radiusY : Float
, rotation : Float
, takeTheLongWay : Bool
, clockwise : Bool
}
-> PathBuilder
-> PathBuilder

draw an arc to a point

( Float, Float )
-> { angle : Float
, takeTheLongWay : Bool
, clockwise : Bool
}
-> PathBuilder
-> PathBuilder

draw a circle arc to a relative point

( Float, Float )
-> { angle : Float
, takeTheLongWay : Bool
, clockwise : Bool
}
-> PathBuilder
-> PathBuilder

draw a circle arc to a point

(( Float, Float ) -> ( ( Float, Float ), String ))
-> PathBuilder
-> PathBuilder

custom path command.

You should only use this if you know what your doing.

```
startAt (50,50)
|> custom (\(x,y) -> ((x+10,y+10),"l10 10"))
|> end
```
toString : Path -> String

Convert the path to a string.

You can use it with elm/svg like this:

    Svg.path
        [ Svg.Attributes.d (toString path)]
        []
type alias PathBuilder =
( ( Float, Float ), Path -> Path )

Builds Paths.

Start building paths with startAt and end it with end.