CoronaSDK函数精解:object:setFillColor

1 填充多边形

local vertices = { 0,-110, 27,-35, 105,-35, 43,16, 65,90, 0,45, -65,90, -43,15, -105,-35, -27,-35 }

local star = display.newPolygon( 300, 300, vertices )
star:setFillColor( 1, 0.2, 0.2 )

 

2 填充文本颜色

local myText = display.newText( "hello", 0, 0, native.systemFontBold, 12 )

myText:setFillColor( 1, 0.2, 0.2 )

 

3 给矩形填充渐变色

local myText = display.newText( "hello", 0, 0, native.systemFontBold, 12 )

myText:setFillColor( 1, 0.2, 0.2 )

 

4 给图片染色

local image = display.newImage( "image.png" )
image:setFillColor( 0.72, 0.9, 0.16, 0.78 )  -- Tints image green

 

posted @ 2014-12-18 14:46  弯弓射月  阅读(915)  评论(0编辑  收藏  举报