Type Number Object ShapeObject Library display.* Revision Release 2022.3683 Keywords stroke, width, border See also ShapeObject:setStrokeColor()
Sets the stroke width of vector objects, in pixels. Note that stroke widths are broken up to inner and outer parts. The stroke is centered on the boundaries of the object, but when the stroke width is odd, Corona does an integer divide by 2 then a math.floor() on the value. For example, 3 / 2 = 1
or 1 / 2 = 0
. The inner width is set to that value, and the remainder is the outer width. This avoids blurring around the edges of the stroke.
The stroke width of an object is 0
by default if not set.
Modifying the stroke width affects the object's width/contentWidth, height/contentHeight, and its hit testing (touch/tap) bounds.
local rect = display.newRect( 135, 100, 50, 50 ) rect:setFillColor( 1 ) rect:setStrokeColor( 1, 0 ,0 ) rect.strokeWidth = 5