How do I darken a png with an alpha channel?

Edit: I figured it out. Set Fill Color works… It was blending into the background. Now, I just need to figure out how to get it to use transition.to

How do I darken a png with an alpha channel?

So far all of my tries end up tinting the entire image rectangle with no regard to the image alpha. 

For reference, I am trying to fade a “monster.png” up from black to it’s base RGB values.

Any ideas?

Thanks,

Gullie

I don’t think you can change colors with any traditional transitions, but you could try with a custom transition.

Something like:

r = display.newRect(100,100,100,100); r.color=0 -- custom attribute for use in transition r:setFillColor(r.color); local function changeColor(t, b, c, d) local newValue = (d - c) / b \* t; -- calculate linear transitional values r:setFillColor(newValue / 100); return newValue; end transition.to(r, {time=1000, color=100, transition=changeColor});

I like it. Thanks!

I don’t think you can change colors with any traditional transitions, but you could try with a custom transition.

Something like:

r = display.newRect(100,100,100,100); r.color=0 -- custom attribute for use in transition r:setFillColor(r.color); local function changeColor(t, b, c, d) local newValue = (d - c) / b \* t; -- calculate linear transitional values r:setFillColor(newValue / 100); return newValue; end transition.to(r, {time=1000, color=100, transition=changeColor});

I like it. Thanks!