Skip to content
Christopher Nikkel edited this page Dec 22, 2018 · 12 revisions

Length

Definition

type Length =
    | UserSpace of float
    | Pixels of int
    | Em of float
    | Percent of float

Description

Length is used to described a distance in coordinate space often from the origin. It is the foundation to other base types such as Point and Area.

Constants

Constant Type Description
Length.empty Length zero length
Length.half Length 50% length
Length.full Length 100% length

Functions

Function Signature Description
Length.ofUserSpace float -> Length creates a length specified with a distance in user space
Length.ofPixels int -> Length creates a length specified with a distance in pixels
Length.ofFloat float -> Length creates a length specified with a distance in user space (alias for ofUserSpace)
Length.ofInt int -> Length creates a length specified with an integer distance in user space
Length.ofEm float -> Length creates a length specified with a distance in Ems
Length.ofPercent float -> Length creates a length specified with percentage based distance
Length.toString Length -> string converts a length to a string
Length.toFloat Length -> float unboxes a length value

Usage

Example

let length1 = Length.ofFloat 10.0
let length2 = Length.full

printfn "length1 = %s" <| Length.toString length1
printfn "length1 = %s" <| Length.toString length2

Output

length1 = "10"
length1 = "100%"

Table of Contents

Getting Started

Fundamentals

Basic SVG Elements

Advanced Elements

Experimental

Clone this wiki locally