Skip to content
On this page

Ellipse Shape

TIP

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

TIP

This component also supports a return function

To create an ellipse shape with fcanvas, we can instantiate a Ellipse object.

In addition, this shape also provides a few other parameters:

Require Options

NameTypeDescription
radiusXMayBeRef<number>defines x radius
radiusYMayBeRef<number>defines y radius

Inherit Shape

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

Optional Options

NameTypeDefaultDescription
rotateMayBeRef<number>0 degressThe rotation of the ellipse, expressed in degress

TIP

The rotate mentioned above is different from the rotation property that inherits from Shape even though they manifest the same

Demo

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

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

const ellipse = new Ellipse({
  x: stage.size.width / 2,
  y: stage.size.height / 2,
  radiusX: 100,
  radiusY: 50,
  fill: "yellow",
  stroke: "black",
  strokeWidth: 4
}).addTo(layer)

Released under the MIT License.