object.strokeWidth

Type Number
Object ShapeObject
Library display.*
Revision Release 2024.3703
Keywords stroke, width, border
See also ShapeObject:setStrokeColor()

Overview

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.

Gotchas

Example

local rect = display.newRect( 135, 100, 50, 50 )
rect:setFillColor( 1 ) 
rect:setStrokeColor( 1, 0 ,0 )
rect.strokeWidth = 5