display.newCircle()

Type Function
Library display.*
Return value ShapeObject
Revision 2017.3109
Keywords circle, vector object
See also Shapes — Paths, Fills, Strokes (guide)
Display Objects (guide)

Overview

Creates a circle with radius radius centered at specified coordinates (xCenter, yCenter). The local origin is at the center of the circle and the anchor point is initialized to this local origin.

Gotchas

Vector circles of very small radius (less than 10 for example) may appear as multi-sided polygons instead of smooth circles. This will be more apparent if your content area is smaller than the device's native resolution. In these cases, if you want to display a very small circle, it may be better to use a circular image instead of a vector.

Syntax

display.newCircle( [parent,] xCenter, yCenter, radius )
parent (optional)

GroupObject. An optional display group in which to insert the circle.

xCenter / yCenter (required)

Numbers. The x and y coordinates for the center of the circle.

radius (required)

Number. The radius for the circle. This must be greater than 0.

Properties

(Inherits properties from ShapeObject)

Shape objects have a path property that exposes properties of the path:

object.path.radius

Number. Radius of the circle.

Examples

local myCircle = display.newCircle( 100, 100, 30 )
myCircle:setFillColor( 0.5 )
myCircle.strokeWidth = 5
myCircle:setStrokeColor( 1, 0, 0 )