Polygons take a number of points and create a closed shape.
import{ Mafs, Theme, Polygon, Coordinates, useMovablePoint }from"mafs"functionTrianglePool(){const a =[2,0]as[number,number]const b =[-2,0]as[number,number]const c =useMovablePoint([0,2])return(<Mafs><Coordinates.Cartesian/><Polygonpoints={[[c.x,-c.y], a, b]}strokeStyle="dashed"/><Polygonpoints={[c.point, a, b]}color={Theme.blue}/>{c.element}</Mafs>)}
TSX
Props
<Polygon ... />
Name
Description
Default
svgPolygonProps
SVGProps<SVGPolygonElement>
β
points
Vector2[]
β
color
string
β
weight
number
β
fillOpacity
number
β
strokeOpacity
number
β
strokeStyle
"solid" | "dashed"
β
import{ Mafs, Theme, Polyline, Coordinates, useMovablePoint }from"mafs"functionLightningBolt(){const a =[-2,-2]as[number,number]const b =useMovablePoint([-1,1])const c =useMovablePoint([1,-1])const d =[2,2]as[number,number]return(<Mafs><Coordinates.Cartesian/><Polylinepoints={[a, b.point, c.point, d]}color={Theme.blue}/>{b.element}{c.element}</Mafs>)}