rect()

本参考资料用于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.

名称

rect()

示例
 rect(30, 20, 55, 55);

 rect(30, 20, 55, 55, 7);

 rect(30, 20, 55, 55, 3, 6, 12, 18);

描述 Draws a rectangle to the screen. A rectangle is a four-sided shape with every angle at ninety degrees. By default, the first two parameters set the location of the upper-left corner, the third sets the width, and the fourth sets the height. The way these parameters are interpreted, however, may be changed with the rectMode() function.

To draw a rounded rectangle, add a fifth parameter, which is used as the radius value for all four corners.

To use a different radius value for each corner, include eight parameters. When using eight parameters, the latter four set the radius of the arc at each corner separately, starting with the top-left corner and moving clockwise around the rectangle.

语法
rect(a, b, c, d) rect(a, b, c, d, r) rect(a, b, c, d, tl, tr, br, bl)
参数
a float: x-coordinate of the rectangle by default
b float: y-coordinate of the rectangle by default
c float: width of the rectangle by default
d float: height of the rectangle by default
r float: radii for all four corners
tl float: radius for top-left corner
tr float: radius for top-right corner
br float: radius for bottom-right corner
bl float: radius for bottom-left corner
返回值 void
相关 rectMode()
quad()

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

rect()