Skip to main content
Version: 9.0.2

canvas.strokeEllipse

canvas.stroke_ellipse(x, y, radius_x, radius_y, rotation, color)

Draw a stroked ellipse defined by the center position (x,y), with x radius radius_x, y radius radius_y, rotation angle rotation, and with the color color.

Parameters

ParameterTypeDescription
xnumberThe x position of the center of the ellipse.
ynumberThe y position of the center of the ellipse.
radius_xnumberThe radius in the x direction.
radius_ynumberThe radius in the y direction.
rotationnumberThe rotation angle in degrees clockwise.
colornumberAn RGB color value as an integer value.

Example

// Draw two stroked ellipses on the canvas with the color black
function fastTires(name) {
var canvas = sb.getCanvas(name);
var x = canvas.width / 2;
var y = canvas.height / 2;
var r = canvas.width / 9;
var dist = canvas.width / 2;
canvas.lineWidth = 0.6 * r;
canvas.strokeEllipse(x + dist / 2, y, r, 1.1 * r, 15, 0);
canvas.strokeEllipse(x - dist / 2, y, r, 1.1 * r, 15, 0);
}