Total Pageviews

Friday, May 30, 2014

Type Line()

នេះជា Type LineObject របស់ Corona SDK
សំរាប់ Line Objects ត្រូវបានបង្កើតឡើងដោយការប្រើ display.newLine()
នេះជា Properties របស់វា
Object.anchorSegments:
វាជា Boolean property ដែលគ្រប់គ្រង់ថាតើ LineObjects យក anchor & anchorY into account។ តំលៃដើមគឺ false
សូមមើលកូដះ
local star = display.newLine( 200,90, 227,165, 305,165, 243,216, 265,290, 200,245, 135,290, 157,215, 95,165, 173,165, 200,90 )
star.x = display.contentWidth * 0.5
star.y = display.contentHeight * 0.5

star.anchorSegments = true
star.anchorX = 0.75
star.anchorY = 0.25

នេះជា Methods របស់វា
object:append() វាជា append one or more segments ទៅកាន់ existing object ដែលបានបង្កើតឡើងដោយការប្រើ display.newLine()
syntax: LineObject:append (x,y [,…])
x,y,…(តំរូវការ) វាជាចំនួនលេខដោយ more or more [x,y] pairs ក្នុងការ specifying a new point to extent the existing line
សូមមើលកូដះ
local star = display.newLine( 0,-110, 27,-35 )
star:append( 105,-35, 43,16, 65,90, 0,45, -65,90, -43,15, -105,-35, -27,-35, 0,-110 )
star:setStrokeColor( 0, 0, 1 )
star.strokeWidth = 5


object:setStrokeColor()
ប្រើសំរាប់បញ្ចូលនៅ stroke (border) color របស់ vector objects
Syntax: object:setStrokeColor (gray)
Object:setStrokeColor(gray,alpha)
Object:setStrokeColor(gray,green,blue)
Object:setStrokeColor (gray,green,blue,alpha)
Gray,red, green,blue,alpha (តំរូវការ) វាជាចំនួនលេខដែលនៅចន្លោះ ០នឹង១ ដែលជាតំណាង value for that channel។ សំរាប់ alpha តំណាងឪ្យ opacity of the stroke
local rect = display.newRect( 150, 150, 100, 100 )
rect:setFillColor( 1, 1, 0.8 )
rect:setStrokeColor( 1, 0, 0 )
rect.strokeWidth = 8

object.strokeWidth() វាប្រើសំរាប់បញ្ចូលនៅ Stroke width របស់ vector objects នៅក្នុង Pixels។  សូមចំណាំថា Stroke widths វាជា broken up to inner and outer parts។ សំរាប់ stroke វានៅ centered នៅលើ boundaries object ប៉ុន្តែនៅពេល Stroke width is odd, corona does an integer divide by 2 then a math.floor() on the value។ តំលៃដើមគឺ០
សូមមើលកូដះ
Local rect = display.newRect (120,120,50,60)
Rect:setStrokeColor (1,0,0)
Rect.strokeWidth = 5


No comments:

Post a Comment