×
A new build of Corona SDK is now available to subscribers. Not a subscriber? Subscribe now.
CoronaSDK 2014.2281 | Released: 24 Apr 2014, 1:58am | What's New | Download Now

object.maskX

Description:

Retrieve or set the x-position of the mask applied to the display object using object:setMask().

Syntax:

1
2
object.maskX
value = object.maskX

Example:

This sample moves the mask applied to the corresponding image to the position where the user moves their finger on the display.

-- Image to be masked
local image = display.newImageRect( "image.png", 768, 1024 )
image:translate( halfW, halfH )
 
-- Mask
local mask = graphics.newMask( "circlemask.png" )
image:setMask( mask )
 
function onTouch( event )
        local t = event.target
        local phase = event.phase
        if "moved" == phase then
                t.maskX = event.x
                t.maskY = event.y
         end
end
 
image:addEventListener( "touch", onTouch )

Parameters:

None.

Returns:

number: maskX of object.

Remarks:
Supported on operating systems and platforms for build numbers shown:
  • Mac OS X:
    Build 2011.268
  • Windows:
    Build 2011.288
  • iOS:
    Build 2011.268
  • Android:
    Build 2011.288