Skip to content
Christopher Nikkel edited this page Dec 23, 2018 · 11 revisions

Rect

Definition

type Rect =
    {
        Position: Point
        Size: Area
        CornerRadius: Point option
    }

Description

Rect is used to create a SVG rectangle.

Functions

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

Usage

Example

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"

Output

<rect stroke="green" stroke-width="3" fill="red" opacity="1" x="55" y="45" width="25" height="15"/>

Table of Contents

Getting Started

Fundamentals

Basic SVG Elements

Advanced Elements

Experimental

Clone this wiki locally
You can’t perform that action at this time.