类型 数字 对象 DisplayObject 库 display.* 版本 Release 2024.3703 关键词 遮罩,y,遮罩位置,图像遮罩,遮罩,裁剪,位遮罩 另请参阅 object.maskX object:setMask()
检索或设置 mask 的y 位置,此遮罩通过 object:setMask() 应用于显示对象。
-- This example moves the image mask to the position where the user moves their finger -- 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 if ( event.phase == "moved" ) then t.maskX = event.x t.maskY = event.y end end image:addEventListener( "touch", onTouch )