Circle

Type    

class

[gd]

Inheritance

Circle ⟶ ShapeDisplay ⟶ Object

[bg]

Overview

Creates a circle shape.


See also 

Shape, Display



Overview


  Creates a circle shape.


  Circle class inherits Display class, therefore all the methods defined in Display class can also be used in the Circle object.



Syntax



Circle(radius  [,option] )


    • radius - (required) the radius of the circle

    • option - (optional) table containing parameters


        option = {

                strokeWidth = n, -- (default = 0) width of stroke

                strokeColor = color, -- (default = Color.WHITE) stroke color

                fill = color, -- (default = Color(Color.WHITE,1)) color and alpha for fill

        }


  Note that the initial anchor point is the center of the circle.


Methods



method

description

obj:setStrokeWidth(n)

set width of outline

obj:setStrokeColor(color)

set color of outline with Color object

obj:fill(color)

set color of inner area with Color object

obj:empty()

display stroke only

obj:setRadius(num)

change radius as num


Note that all the methods in Display class are callable.



Examples



Circle(100)


local c = Circle(100,{fill=Color.RED})


local c= Circle( 100, {strokeWidth=10,strokeColor=Color.BLUE} )

Timer(5000, function() c:setStrokeColor(Color.RED) end) -- change stroke color after 5 seconds


local c = Circle(100, {

    fill=Color.RED,

    strokeColor=Color.YELLOW,

    strokeWidth=10,

} )


댓글 없음:

댓글 쓰기