Heart

Type    

class

[gd]

Inheritance

Heart ⟶ Shape  ⟶ Display ⟶ Object

[bg]

Overview

Creates a heart shape.


See also 

Shape, Display



Overview


  Creates a heart shape.


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



Syntax



Heart(radius  [, option] )


    • radius - (required) the radius of the outer tangent 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:setRadius(num)

change radius as num



Examples



Heart(100)


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


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

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


local c = Heart(100, {

    fill=Color.RED,

    strokeColor=Color.YELLOW,

    strokeWidth=10,

} )


댓글 없음:

댓글 쓰기