Ellipse
An ellipse is a radial object that can be specified using either the radius
property or the two radius_x
and radius_y
. If the first is specified, or if the other two have the same value, it will result in a circle.
Properties
- radius : Number
- If
radius_x
andradius_y
are the same, it will be a circle. Setting thisradius
property sets both the other two to the same value. Getting this property will return the x radius. - radius_x : Number
- The horizontal radius.
- radius_y : Number
- The vertical radius.
Examples
Example 1
We start by creating a new core instance. Then we create an ellipse with different radii, and a stroke.
View Example
Code
var canvas = oCanvas.create({
canvas: "#canvas",
background: "#ccc"
});
var ellipse = canvas.display.ellipse({
x: 177,
y: 135,
radius_x: 80,
radius_y: 40,
stroke: "10px #0aa"
});
canvas.addChild(ellipse);
Output
Example 2
We start by creating a new core instance. Then we create an ellipse with the same radii, and a fill, creating a circle.
View Example
Code
var canvas = oCanvas.create({
canvas: "#canvas",
background: "#ccc"
});
var ellipse = canvas.display.ellipse({
x: 177,
y: 135,
radius: 80,
fill: "#0aa"
});
canvas.addChild(ellipse);
Output