Image Fading Transparency


#1

Hello to everyone.

I’m new with JUCE. I have a question regarding the transparency of an image.

I 've created a component, “testcomp” with jucer that has two image resources, png1, png2.

When i load this component to the editor i want png1 to start fade in and out. png1 is painted first and png2 second on top of png1.
I start the timer in the constructor of “testcomp” and in timerCallback i change a float variable, “fader” from 0.0f to 1.0f.

First way i try doing it:
I tried the multiplyAllAlphas function of png1 with “fader” as an argument. Nothing happened.

Second way i try doing it:
In the paint function i change setOpacity with “fader” before drawing png1 and setOpacity with 1.0f before drawing png2.
What happens with this approach is png1 constantly becoming brighter.

The idea is to make png1 an indicator for whether the user has hovered over the testcomp.

Thanks in advance