Question

How would I make an Image have a pulsating effect to it? I already know how to draw an Image to the screen, so I just need to know how I can add a pulsating glow effect. Would I need to use tons of threads?

Also, how would I make some text have the same pulsating glow effect?

I want to be able to draw this to the screen so this needs to be a graphics object (g.drawString(glowingText, x, y);).

Thanks in advance!

Was it helpful?

Solution

AlphaTest shows one approach using Alpha Composite; FlashTest shows another using getHSBColor(). You can infer which is more popular.

Addendum: To get a pulsating glow behind some text or image, you'll want to vary the background alpha instead of the foreground. There's a related example here. I often use this utility to preview the effects of different composite modes.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top