question about masks

I’m planning to add a page curl to an app so I was studying this code:

https://github.com/dedoubleyou1/Corona-Flipbook-Module/commit/2b0bf7961872dfed522d858896eb718b5872d495

There are a few of things that I don’t understand and I was hoping you could help me.

First, it seems he is using the same mask on multiple images.  I have always envisioned masks as images and images can only be in one display group.  If I applied a mask to an image then I assume that if I applied it to a different image it would remove it from the first.  Can you explain what really is going on to me?

Second, his mask1.png seems to be a white pixel to the left of a black pixel, what is that doing for him?  I have used masks, mostly just a circle mask, but I was under the impression that I needed a black boundary all the way around the white part and that it needed to be at least 3 pixels (per this article): http://docs.coronalabs.com/guide/media/imageMask/index.html

Finally, and this doesn’t have anything to do with masks, why is he putting his display group in his metatable, is that just a way to keep from losing it?  If I have a display group I need to keep handy, I have always just referenced it with a variable on the scene.view object.  Is what I’m doing a bad practice?  I realize he isn’t using composer, but why didn’t he just put it outside the function as a local variable to the module?

I’m assuming this works because of this video on YouTube: http://youtu.be/OsHrXZT3DGM

Ok, I downloaded the code and am messing around with it, it doesn’t work anymore.  It loads and runs but several of the assets are not in the right place.  I’m experimenting with it to figure out what needs to be changed.  I don’t use display.newImage, I have always used display.newImageRect so I’m having to figure that out too.

One thing that is broken about this module is that the “backPage”, what appears as the back side of the page, is in the wrong place.  It appears around the middle of the page.  It is my best guess that the problem is that he was trying to move the anchorX point with xReference which may have worked two years ago when this was written but doesn’t work now.

If you are trying to make this work, remember that anchorX is a fraction between 0 and 1

I tried it like this:

self.backPage.anchorX = (display.contentWidth - (tempX * 1.1))/display.contentWidth

and it’s close but not perfect.

Ok, I downloaded the code and am messing around with it, it doesn’t work anymore.  It loads and runs but several of the assets are not in the right place.  I’m experimenting with it to figure out what needs to be changed.  I don’t use display.newImage, I have always used display.newImageRect so I’m having to figure that out too.

One thing that is broken about this module is that the “backPage”, what appears as the back side of the page, is in the wrong place.  It appears around the middle of the page.  It is my best guess that the problem is that he was trying to move the anchorX point with xReference which may have worked two years ago when this was written but doesn’t work now.

If you are trying to make this work, remember that anchorX is a fraction between 0 and 1

I tried it like this:

self.backPage.anchorX = (display.contentWidth - (tempX * 1.1))/display.contentWidth

and it’s close but not perfect.