Skip to content

Documentation / spryte / polygon

Function: polygon() ​

polygon(draw, points, color, count?): void

Defined in: shapes.ts:14

Filled polygon through points (x0, y0, x1, y1, …), antialiased. Concave is fine; it closes itself and shouldn't cross itself. count defaults to every pair in points.

ts
import { polygon } from "spryte";
polygon(draw, [0, 0, 20, 0, 10, 16], "#cffb2d");

Parameters ​

draw ​

Draw

points ​

ArrayLike<number>

color ​

Color

count? ​

number = ...

Returns ​

void