Text Animation

Hello guys, I have a question to you today ! Is there any text animation API to use, I mean like scale animation and such, until now i’m using HTML, but I’m not too good at it and it would be nice if it had one of those.

Btw, nice to meet you, first thread here :smiley:

PS: Btw², if anyone here know how to create a “path” to a zombie to follow, or knows about a thread about that, plz post it :smiley:

Would be interesting if there was, I really dislike how gmod handles text in general, it seems really restrictive that you have to define fonts with values rather than scale on-the-fly for example.

Totally Agree.

I’d like to know why you disagree Tolee, Is there something I don’t know about?

lol, I said I Agree .-. :smile:

And BTW

I found a “recent” thread about some GUI arts, and there’s a lot of text animations, if you want to see here’s the link : http://facepunch.com/showthread.php?p=45022180#post45022180

Yeah you did :wink: I meant Tolee who left a disagree rating and didn’t say why.

Oh I see. :smiley:

because text is insanely flexible if you know what your doing.
rotating, pulsing, and many more possibilities can be done with cam.PushModelMatrix.

I didn’t know about that one, will try ! Thanks for the tip.

While true, it would be nice if basic text functionality was more accessible than it currently is.

For sizes, you could always just scale a cam matrix n draw a font that starts off really large.

It affects quality though.

[lua]
surface.CreateFont(“BigFont”, {
font = “Arial”,
size = 256,
})

local m = Matrix()
local s = Vector()
local v = Vector()

function draw.DrawString( str, font, fontsize, x, y, color, align )
s.x = fontsize / 128 – more accurate as half the original size for some reason…
s.y = fontsize / 128
v.x = x
v.y = y

m:SetScale(s)
m:SetTranslation(v)

cam.PushModelMatrix(m)
	draw.DrawText(str, font, 0, 0, color, align)
cam.PopModelMatrix()

local w, h = surface.GetTextSize(str)

w = w * s.x
h = h * s.y

surface.SetDrawColor( Color(255, 0, 0) )
surface.DrawOutlinedRect(x, y, w, h)

return w, h

end

hook.Add(“HUDPaint”, “TestFontSize”, function()
local x, y = 16, 16

for i = 1, 8, 1 do
	y = y + select(2, draw.DrawString( "Test1", "BigFont", i * 16, x, y, color_white, TEXT_ALIGN_LEFT ))
end

end)[/lua]

http://puu.sh/a51Er/2f09be5f46.png[/t]

Quality is slightly better with TEXFILTER.ANISOTROPIC

[lua] cam.PushModelMatrix(m)
render.PushFilterMag(TEXFILTER.ANISOTROPIC)
render.PushFilterMin(TEXFILTER.ANISOTROPIC)
draw.DrawText(str, font, 0, 0, color, align)
render.PopFilterMin()
render.PopFilterMag()
cam.PopModelMatrix()[/lua]

[t]http://puu.sh/a51N7/121d02dac2.png

I didn’t know about this cam matrix thing, I’m testing since yesterday and it seems to solve my problem ! Will mark as solved Cya