Skip to content
On this page

Ring Shape

TIP

This class is a descendant of Arc it also inherits all the options that Arc provides.

TIP

This component also supports a return function

To create a ring with fcanvas, we can instantiate a Ring object.

All properties are inherited from Arc

Require Options

Inherit Arc

NameTypeDescription
innerRadiusMayBeRef<number>inner ring radius length
outerRadiusMayBeRef<number>outer circumference length

Inherit Shape

NameTypeDescription
xMayBeRef<number>offset x
yMayBeRef<number>offset y

Demo

ts
import { Stage, Layer, Ring } from "fcanvas"

const stage = new Stage().mount("#app")
const layer = new Layer().addTo(stage)

const ring = new Ring({
  x: stage.size.width / 2,
  y: stage.size.height / 2,
  innerRadius: 40,
  outerRadius: 70,
  fill: "yellow",
  stroke: "black",
  strokeWidth: 4
}).addTo(layer)

Released under the MIT License.