How To Animate Things?

Hello, I was wondering how to animate HUD objects. I know that there is a draw = function() {} in Javascript, so is there one similar to that in lua? I’ve tried searching Google and YouTube, but all I’ve found is Animation Editor tutorials. The wiki doesn’t show anything but how to animate DPanels. Thanks :slight_smile:

P.S. I’m trying to animate draw.RoundedBox (I can switch to surface.DrawRect if needed) and draw.SimpleText (I can switch to surface.DrawText if needed).

If your HUD is using vgui elements, you’d do your animation in

PANEL:Paint. Otherwise you’d do it in HUDPaint. The animation itself is done by just changing the position where you draw the box every frame.

If you’re using draw.RoundedBox, it’s already likely you’re drawing it in a HUDPaint hook or a similar drawing hook. These should act fairly similar to that javascript function. If not, the reply above will help

What sort of animations/effects are you trying to achieve?

[editline]8th February 2017[/editline]

I mean, specifically. (Make the box move from one place to another, rotate, move the text, change the text color, etc.?)