Should it be possible to change the blendMode of an image during a game?
Below is a modified version of
http://www.coronalabs.com/blog/2012/10/30/creative-effects-using-blend-modes/
Tapping should cycle through the blend modes.
Perhaps their is some sort of refresh call that I need to make after making the change?
blendModes = {“normal”, “add”, “multiply”, “screen”}
local currentBlendModeIndex = 1
display.setStatusBar( display.HiddenStatusBar )
local halfW = display.contentCenterX
local halfH = display.contentCenterY
– Black background
bkg = display.newRect( 0, 0, 768, 1024 )
bkg:setFillColor( 0 )
– Swamp Backdrop
swamp = display.newImageRect( “swamp.jpg”, 768, 1024 )
swamp:translate( halfW, halfH )
– Wisps lights
wisps = display.newImageRect( “wisps.png”, 768, 1024 )
wisps:translate( halfW, halfH )
wisps.blendMode = blendModes[currentBlendModeIndex]
print ("Now in "… wisps.blendMode)
function onTap( event )
local t = event.target
print(“Began tap event.”)
currentBlendModeIndex = currentBlendModeIndex + 1
if currentBlendModeIndex == 5 then
currentBlendModeIndex = 1
end
t.blendMode = blendModes[currentBlendModeIndex]
print ("Now in "… t.blendMode)
return true
end
wisps:addEventListener( “tap”, onTap )
------------------------------ [import]uid: 199243 topic_id: 35916 reply_id: 335916[/import]