Type Function Library display.* Return value ShapeObject Revision 2017.3145 Keywords rounded rectangle, rectangle, vector object See also Shapes — Paths, Fills, Strokes (guide) Display Objects (guide)
Creates a rounded rectangle object. The corners are rounded by quarter circles of a specified radius value. The local origin is at the center of the rectangle and the anchor point is initialized to this local origin.
If the corner radius is greater than half of the rectangle's width or height, the actual radius will be decreased so that the rounded rectangle is rendered as a "capsule" shape.
display.newRoundedRect( [parent,] x, y, width, height, cornerRadius )
GroupObject. An optional display group in which to insert the rounded rectangle.
Numbers. The x and y coordinates for the center of the rectangle.
Numbers. Width and height of the rectangle.
Number. Corners are rounded by quarter circles of this radius value.
(Inherits properties from ShapeObject)
Rounded rectangle objects have a
path property which lets you modify the radius, width, and height:
Number. Radius of the corners. This cannot be set to a value larger than half the width or height of the rectangle.
Number. Height of the rectangle.
Number. Width of the rectangle.
local myRoundedRect = display.newRoundedRect( 0, 0, 150, 50, 12 ) myRoundedRect.strokeWidth = 3 myRoundedRect:setFillColor( 0.5 ) myRoundedRect:setStrokeColor( 1, 0, 0 )