Rotating a group using transition.to that have a masked object (+ masking colors trick!)

Hey there!

I have a issue that I either think is a bug or it might be that I’m handling something in a wrong way.

I use bitmap masks (e.g. the shape of an eye brow) by applying them to a same-size rectangle (in the color I want the shape of the mask to be in).

This makes me in this case create an eye brow in different colors simply by changing the color of the rectangle and only having one image for this (instead of having one image per color).

The problem is:
The rectangle (that holds the mask) is part of a group.
It works to set the group.rotation property directly to properly rotate the whole thing…

But when I use translation.to instead, setting that same group rotation with the function instead over time, the mask doesn’t seem to follow at all… ?

translation.to works if I directly point at the rectangle, but this isn’t the case since it is part of a display hierarchy…

I hope you get what I’m getting at! Trying to find a workaround… Been thinking about even making my transition engine but I should be able to use the current one.

To test this for yourself, you need a irregular black/white mask to see how the example works. Currently I can’t seem to find any way to find the original image if it is a mask, thats why I’m using an extra image to get this value.

Anyone have any ideas? :wink:
Any help is greatly appreciated!
[lua]group = display.newGroup();

– only for finding out the size (todo: load size from json or fix in some other way)
local image = display.newImage(“hair_blondmask-size-help.jpg”)
local width = image.width;
local height = image.height;
image:removeSelf(); --remove when size is known

local mask = graphics.newMask(“hair_blondmask.jpg”)

rect = display.newRect(0, 0, width, height);
rect:setFillColor(234, 191, 92, 255); – color of ouput is set here!
rect:setMask(mask)

group:insert( rect )
transition.to( group, { time=10000, rotation = 180}
–group.rotation = 180; --works, however![/lua] [import]uid: 90232 topic_id: 16783 reply_id: 316783[/import]