Total Pageviews

Wednesday, March 19, 2014

មានប្រភេទ Container នេះមួយទៀត



សំរាប់ Containers ជាប្រភេទ Group ពិសេសដែលវាអាចឪ្យ Children masked បាន

Syntax: display.newContainer ([parent, ] width, height)

ដែនកំនត់ះ ដោយសារ container objects​ត្រូវបានបង្កើតឡើងដោយប្រើ Mask។ ដូចនេះនៅពេលដែលមាន Mask ត្រូវការ Nesting នោះវាមាន
ដែនកំនត់សំរាប់បី Platforms

សូមមើលកូដះ
-- Create a container
local container = display.newContainer( 128, 128 )

-- Create an image
local bkgd = display.newImage( "bg.jpg" )
-- Insert the image into the container
container:insert( bkgd, true )
-- Center the container in the display area
container:translate( display.contentWidth*0.5, display.contentHeight*0.5 )

-- Transition (rotate) the container
transition.to( container, { rotation=360, transition=easing.inOutExpo} )

No comments:

Post a Comment