Skip to content

Polygon

Christopher Nikkel edited this page Dec 23, 2018 · 12 revisions

Polygon

Definition

type Polygon =
    {
        Points: seq<Point>
    }

Description

Polygon is used to create a SVG polygon.

Functions

Function Signature Description
Polygon.create seq<Point> -> Polygon create a Polygon with a sequence of Points
Polygon.ofSeq seq<Point> -> Polygon create a Polygon with a sequence of Points
Polygon.ofList Point list -> Polygon create a Polygon with a list of Points
Polygon.ofArray Point [] -> Polygon create a Polygon with an array of Points
Polygon.toString Polygon -> string convert a Polygon to a string

Usage

Example

let points =
  seq {
    yield Point.ofInts (55, 45);
    yield Point.ofInts (45, 45);
    yield Point.ofInts (45, 15);
    yield Point.ofInts (10, 5);
  }

let style = Style.create (Name Colors.Yellow) (Name Colors.Red) (Length.ofInt 3) 1.0 1.0

points
  |> Polygon.ofSeq
  |> Element.createWithStyle style
  |> printf "%O"

Output

<polygon stroke="red" stroke-width="3" fill="yellow" opacity="1" points="55,45 45,45 45,15 10,5"/>

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.