Animated text.

I was thinking about how is animated text, for example a text that appears on the screen then moves upwards and dissapears or just simply appears and fades out made?
I have been browsing the mighty internet for a while without any results.
Thanks

It’s quite a complex process (at least for me it was).
The way I did it, I made a table filled with information about the text
[lua]local tbl = {
text = str,
pos = ScrH() *0.8,
alpha = 0,
time = CurTime(),
color = color,
}[/lua]
Since I was adding these items to a larger table, I had to store a bit more information, like the time it was created (CurTime()), and it’s position, etc.

I iterated through my table of items, and did a process like this:


Is the alpha of the text (item.alpha) at 255 and is it not being removed?
	Yes: Approach the alpha to 255 (math.Approach())
Is this item the fifth in the table or is it's time up ( ( CurTime() -item.time ) >= timeToDraw )?
	Yes: Mark the item as removing (item.removing = true),
	Approach the alpha to 0
Is the alpha <= 0 and is it being removed?
	Yes: Remove the item from the table

I had some positioning work that I had to do too, but I removed that as the text moved downwards when it was created. You could probably make your own using the process I explained above.