Polygons

Polygons take a number of points and create a closed shape.

import { Mafs, Theme, Polygon, Coordinates, useMovablePoint } from "mafs" function TrianglePool() { const a = [2, 0] as [number, number] const b = [-2, 0] as [number, number] const c = useMovablePoint([0, 2]) return ( <Mafs> <Coordinates.Cartesian /> <Polygon points={[[c.x, -c.y], a, b]} strokeStyle="dashed" /> <Polygon points={[c.point, a, b]} color={Theme.blue} /> {c.element} </Mafs> ) }

Props

<Polygon ... />
NameDescriptionDefault
points
Vector2[]
svgPolygonProps
SVGProps<SVGPolygonElement>
{}
color
string
var(--mafs-fg)
weight
number
2
fillOpacity
number
0.15
strokeOpacity
number
1
strokeStyle
"solid" | "dashed"
solid