Can you mask sprites, or use sprites as masks?

Starting to work with masking & wondering if the best practice is to utilise sprites here at all.  Questions I have:

Q1 - Can you use a Sprite as a mask somehow?   

Q2 - Can you apply a mask to a sprite?  

As far as I can see the answers are no/no, so you need to stick with images, but just checking…

Q1, not currently

Q2, yes, you can apply a mask to a sprite.

thanks Walter:

re Q2 & the fact you can apply a mask to a sprite - Will this occur in a manner that will automatically support dynamic image resolutions? (i.e. the MyImage_@2, MyImage_@3 approach_.  That is I know that sprites can follow this dynamic behavior, so just confirming that when you apply a mask to sprite it would follow accordingly, such that Corona would choose that mask image with the correct resolution too… 

Q1, not currently

Q2, yes, you can apply a mask to a sprite.

thanks Walter:

re Q2 & the fact you can apply a mask to a sprite - Will this occur in a manner that will automatically support dynamic image resolutions? (i.e. the MyImage_@2, MyImage_@3 approach_.  That is I know that sprites can follow this dynamic behavior, so just confirming that when you apply a mask to sprite it would follow accordingly, such that Corona would choose that mask image with the correct resolution too… 

Hi Walter

We have tried to apply a mask to a sprite without success because the mask is applied to the “image” once and not animated.

How can we apply a sprite sheet mask to a sprite sheet so that each frame is masked as it animates?

HI! Would like to know about this too! I am also having a sprite of character and wanting it to be masked. How should I do it?

Thanks

Bumps

You can do (1), but with some effect:

local item\_mc = display.newImage(localGroup, mySheet, 10); local effect = "composite.colorBurn";-- colorBurn, darken, hardLight, hardMix, multiply, overlay, subtract, vividLight (this effects works as maks too) local object = display.newRect(localGroup, \_W/2-100, 350, item\_mc.width, item\_mc.height ) local compositePaint = { type="composite", paint1={ type="image", filename="image/masks/con\_iced.png"}, paint2={ type="image", sheet=mySheet,frame=10 } } object.fill = compositePaint; object.fill.effect = effect;

example code to use sprite from atlas to mask image.

Hi Walter

We have tried to apply a mask to a sprite without success because the mask is applied to the “image” once and not animated.

How can we apply a sprite sheet mask to a sprite sheet so that each frame is masked as it animates?

HI! Would like to know about this too! I am also having a sprite of character and wanting it to be masked. How should I do it?

Thanks

Bumps

You can do (1), but with some effect:

local item\_mc = display.newImage(localGroup, mySheet, 10); local effect = "composite.colorBurn";-- colorBurn, darken, hardLight, hardMix, multiply, overlay, subtract, vividLight (this effects works as maks too) local object = display.newRect(localGroup, \_W/2-100, 350, item\_mc.width, item\_mc.height ) local compositePaint = { type="composite", paint1={ type="image", filename="image/masks/con\_iced.png"}, paint2={ type="image", sheet=mySheet,frame=10 } } object.fill = compositePaint; object.fill.effect = effect;

example code to use sprite from atlas to mask image.