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.

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.

Speak freely