Skip to main content
Version: 9.0.2

canvas.fillEllipse

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

Draw a filled 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 a pair of cartoon eyes in black and purple
function eyes(name) {
local canvas = sb.getCanvas(name);
local x = canvas.width / 2;
local y = canvas.height / 2;
local dist = canvas.width / 4;
local s = canvas.width / 6;
canvas.fillCircle(x - dist / 2, y, s, 0xeeccff);
canvas.fillCircle(x + dist / 2, y, s, 0xeeccff);
canvas.fillEllipse(x - (dist * 1.2) / 2, y, 0.4 * s, 0.5 * s, 0, 0);
canvas.fillEllipse(x + (dist * 0.8) / 2, y, 0.4 * s, 0.5 * s, 0, 0);
}