Java图像/文本脉动发光效果(图形)
如何使 Image
具有脉动效果?我已经知道如何在屏幕上绘制Image
,所以我只需要知道如何添加脉动发光效果。我需要使用大量线程吗?
另外,我如何使一些文本具有相同的脉动发光效果?
我希望能够将其绘制到屏幕上,因此它需要是一个图形对象(g.drawString(glowingText, x, y);
)。
提前致谢!
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!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
AlphaTest
显示了一种使用Alpha 复合
;FlashTest
显示另一个使用getHSBColor()
。您可以推断哪个更受欢迎。附录:要在某些文本或图像后面获得脉动发光,您需要改变背景 Alpha 而不是前景。 此处有一个相关示例。我经常使用这个实用程序来预览不同合成模式的效果。
AlphaTest
shows one approach usingAlpha Composite
;FlashTest
shows another usinggetHSBColor()
. 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.