Star

Type    

class

[gd]

Inheritance

Star ⟶ ShapeDisplay ⟶ Object

[bg]

Overview

Creates a star shape.


See also 

Shape, Display



Overview


  Creates a star shape. Star class inherits Shape and Display class, therefore all the methods defined in Shape and Display classes can also be used in the Star object.



Syntax



Star(radius  [,option] )


    • radius - (required) the radius of the outer tangent circle

    • option - (optional) table containing parameters


        option = {

                ratio = n, --(default = 0.5)  ratio (= inner circle radius ➗ outer circle radius)

                points = n, --(default = 5) number of vertexts

                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 star.


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:setRadius(num)

change radius as num

obj:setPoints(num)

change number of points as num

obj:setRatio(num)

change ratio as num


Examples


local s = Star(100)


local s = Star(100,{ratio=0.4})


local s = Star(100,{points=8})


local s = Star(100, {

    fill = Color.RED,

    strokeColor = Color.YELLOW,

    strokeWidth = 10,

     points = 6

})


댓글 없음:

댓글 쓰기