ellipseMode()

本参考资料用于Processing 3.0+。 如果你使用的是前一版本,请在使用软件帮助菜单内的参考资料。. If you see any errors or have suggestions, please let us know. If you prefer a more technical reference, visit the Processing Core Javadoc and Libraries Javadoc.

名称

ellipseMode()

示例
 ellipseMode(RADIUS);

// Set ellipseMode to RADIUS fill(255);

// Set fill to white ellipse(50, 50, 30, 30);

// Draw white ellipse using RADIUS mode  ellipseMode(CENTER);

// Set ellipseMode to CENTER fill(100);

// Set fill to gray ellipse(50, 50, 30, 30);

// Draw gray ellipse using CENTER mode 
 ellipseMode(CORNER);

// Set ellipseMode is CORNER fill(255);

// Set fill to white ellipse(25, 25, 50, 50);

// Draw white ellipse using CORNER mode  ellipseMode(CORNERS);

// Set ellipseMode to CORNERS fill(100);

// Set fill to gray ellipse(25, 25, 50, 50);

// Draw gray ellipse using CORNERS mode 
描述 Modifies the location from which ellipses are drawn by changing the way in which parameters given to ellipse() are intepreted.

The default mode is ellipseMode(CENTER), which interprets the first two parameters of ellipse() as the shape’s center point, while the third and fourth parameters are its width and height.

ellipseMode(RADIUS) also uses the first two parameters of ellipse() as the shape’s center point, but uses the third and fourth parameters to specify half of the shapes’s width and height.

ellipseMode(CORNER) interprets the first two parameters of ellipse() as the upper-left corner of the shape, while the third and fourth parameters are its width and height.

ellipseMode(CORNERS) interprets the first two parameters of ellipse() as the location of one corner of the ellipse’s bounding box, and the third and fourth parameters as the location of the opposite corner.

The parameter must be written in ALL CAPS because Processing is a case-sensitive language.

语法
ellipseMode(mode)
参数
mode int: either CENTER, RADIUS, CORNER, or CORNERS
返回值 void
相关 ellipse()
arc()

Updated on October 2, 2018 05:02:08pm EDT

ellipseMode()