-
Notifications
You must be signed in to change notification settings - Fork 8
Rect
Christopher Nikkel edited this page Dec 23, 2018
·
11 revisions
type Rect =
{
Position: Point
Size: Area
CornerRadius: Point option
}
Rect
is used to create a SVG rectangle.
Function | Signature | Description |
---|---|---|
Rect.create |
Point -> Area -> Rect |
create a Rect with a specified Point for the upper left corner and Area |
Rect.withCornerRadius |
Point -> Rect -> Rect |
add rounded corners with a specific radius defined by a Point |
Rect.toString |
Rect -> string |
convert a Rect to a string |
let position = Point.ofInts (55, 45)
let area = Area.ofInts (25, 15)
let style = Style.create (Name Colors.Red) (Name Colors.Green) (Length.ofInt 3) 1.0 1.0
Rect.create position area
|> Element.createWithStyle style
|> printf "%O"
<rect stroke="green" stroke-width="3" fill="red" opacity="1" x="55" y="45" width="25" height="15"/>