@mocanvas/editor · class

Stadium2d

declare class Stadium2d extends Geometry2d

A rectangle with fully rounded ends — a pill. The shorter axis decides the radius, so a square stadium is a circle.

SEMANTICS-ASSUMED: the docs give only { width, height }. Rounding the shorter axis completely is what makes the name "stadium" true at every aspect ratio, and is the only rule under which the shape degenerates sensibly.


Methods · 6

constructor(config: Flags & {
getBounds(): Box
getLength(): number
getVertices(): Vec[]
get radius(): number

The radius of the rounded ends.

toPathWords(): number[]

Properties · 2

readonly h: number
readonly w: number

mocanvas is built by Symbio. Free for non-commercial, non-profit and development use; commercial use needs an agreement. Not affiliated with or endorsed by tldraw.