display.capture() captures a display group, so whatever group your hand and shirt cuff are in can be isolated.
Here’s a simple example using overlapping squares, similar to what mrfox’s image shows, to demonstrate how to use display capture to get what he wants.
[lua]
– Demonstrates fading out a group of objects using a captureGroup to preserve alpha channel relationships between objects
local rectanglesGroup = display.newGroup()
local rectRed = display.newRect(rectanglesGroup,150,50,50,50)
rectRed:setFillColor(250, 0, 0)
local rectBlue = display.newRect(rectanglesGroup,175,75,50,50)
rectBlue:setFillColor(0, 0, 250)
local bounds = rectanglesGroup.contentBounds
local capturedRects = display.capture(rectanglesGroup)
–moves the captured object under the original group.
capturedRects.x = bounds.xMin + .5*rectanglesGroup.width
capturedRects.y = bounds.yMin + .5*rectanglesGroup.height + 100
rectanglesGroup:insert(capturedRects)
local fadeOut
local fadeIn
function fadeOut()
transition.to( rectanglesGroup, { time=3000, alpha=0, onComplete=fadeIn } )
end
function fadeIn()
transition.to( rectanglesGroup, { time=3000, alpha=1, onComplete=fadeOut } )
end
fadeOut()
[/lua]
An issue with this method occurs if any of the original elements already have semi-transparent areas or edges. Display.capture composites the group against black so the semi-transparent areas against nothing will be a lot darker than they should be. You will probably get black fringes around irregularly shaped transparency. I think what we want is for display.capture to pre-composite or pre-multiply alpha.