Reference ellipseMode()

ellipseMode()

Changes where ellipses, circles, and arcs are drawn.

By default, the first two parameters of ellipse(), circle(), and arc() are the x- and y-coordinates of the shape's center. The next parameters set the shape's width and height. This is the same as calling ellipseMode(CENTER).

ellipseMode(RADIUS) also uses the first two parameters to set the x- and y-coordinates of the shape's center. The next parameters are half of the shapes's width and height. Calling ellipse(0, 0, 10, 15) draws a shape with a width of 20 and height of 30.

ellipseMode(CORNER) uses the first two parameters as the upper-left corner of the shape. The next parameters are its width and height.

ellipseMode(CORNERS) uses the first two parameters as the location of one corner of the ellipse's bounding box. The next parameters are the location of the opposite corner.

The argument passed to ellipseMode() must be written in ALL CAPS because the constants CENTER, RADIUS, CORNER, and CORNERS are defined this way. JavaScript is a case-sensitive language.

Examples

Syntax

ellipseMode(mode)

Parameters

mode

either CENTER, RADIUS, CORNER, or CORNERS

Notice any errors or typos? Please let us know. Please feel free to edit src/core/shape/attributes.js and open a pull request!

Related References