Skip to content

Instantly share code, notes, and snippets.

@codepaladin
Last active August 29, 2015 14:13
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save codepaladin/c2d7921dd50d23898683 to your computer and use it in GitHub Desktop.
Save codepaladin/c2d7921dd50d23898683 to your computer and use it in GitHub Desktop.
Path Masking
local path = display.newImage( "Images/WorldMap/path/level2.png") -- base image (yellow line)
local mask = graphics.newMask( "Images/WorldMap/path/level2-mask-0.jpg" ) -- base mask (completely black)
path:setMask( mask )
local ctr = 0
local iterations = 38 -- number of mask images in animation sequence
local function mask( event )
ctr = ctr + 1
path:setMask( nil ) -- remove the previous mask
local mask = graphics.newMask( "Images/WorldMap/path/level2-mask-"..ctr..".jpg" ) -- draw the next mask
path:setMask( mask )
end
timer.performWithDelay( 100, mask, iterations )
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment