Attention | Topic was automatically imported from the old Question2Answer platform. | |
Asked By | Diet Estus |
I am interested in adding a gradient color to my fonts, similar to what you see in the following image from Metal Slug.
Notice how the fonts in the HUD have nice gradient coloring.
Ideally, I’d like to do this in such a way that I can easily adjust the colors on the fly.
Currently, my font is a ttf that I use in a DynamicFont
. I use the font in Buttons
and Labels
all over my game.
Any ideas how to achieve this effect?
There may be a way to do this. You may be able to set the font to a certain color, and then add a canvas above that which has a rainbow effect on it. Then all you need to do is set the blending of the canvas layer such that it blends with the font below it. You could use a CanvasLayer
and change its Image
properties. And if you can’t do that, then you may be able to do it with a shader.
Ertain | 2018-10-17 07:08
I was hoping for a more elegant solution, but I’ll try with a shader and write up a solution if I find one.
Diet Estus | 2018-10-18 23:44
Sorry I couldn’t think up a better way. :-/
Ertain | 2018-10-19 00:34
I’m curious if you ended up finding a solution to this?
Maaack | 2020-10-03 17:00
@Maaack, unfortunately no, never managed to figure it out, so I ended up just using plain white font in my game, Primal Light XD
Please update this thread if you figure anything out!
Diet Estus | 2020-10-03 18:30
@Diet_Estus, thanks for the reply. My approach was to rasterize my text into sprites, align them over the dynamic font (to preserve the outline effect), and apply a shader over them. I’m only doing this for a title screen, because that process will not scale well.
Maaack | 2020-10-06 19:35
Thanks for sharing.
Ertain | 2020-10-06 19:47