The one year game develpoment duel
Jan

15

2015

Transitioning an Image but Not a Mask in Corona SDK

I was recently playing around with image masking, and I wanted to transition the mask so that the image behind it gradually appeared on screen. Unfortunately, Corona doesn’t allow you to transition masks, but after doing a little research I learned that you can use groups to transition the image behind the mask. Here’s an example to see what I’m talking about.

https://www.youtube.com/watch?v=8DhcjrqaqO0&feature=youtu.be

In this example, I have a base image that looks like:

base-image

and a mask that looks like:

example-mask

In order to move the base image and not the mask over the image, I created a new display group, placed the image inside of the group, and then masked the group instead of the image. I was then able to move the image inside of the group without moving the mask in order to achieve my desired effect. Here’s the code that I used for anybody who’s interested.

https://gist.github.com/codepaladin/2ba72935cd2d26b4361b

Speak Freely


Thank you

Your comment will be published once it has been approved.

Click here to see the pull request you generated.