Needing some help with how to animate 3d2dcam ui's
0 replies, posted
Iv been wanting to add animations or some sorta movement on some elements when in view or close to players here's my big bit of code for context sorry for it being real sloppy I am very new to lua. Thanks. I am mainly wanting the stuff at the cur time bit to then be affected on the DrawText's X or Y position axis
local max = CurTime()
local ply = LocalPlayer()
local aVelocity = 15
function ENT:Draw()
local maxDist = 300
local pos = self:GetPos()
local distance = EyePos():Distance( self:GetPos() );
local alpha = math.Clamp( 255 - distance / maxDist * 255, 0, 255 );
local Ang = ply:EyeAngles()
Ang:RotateAroundAxis( Ang:Right(), 90 )
Ang:RotateAroundAxis( Ang:Up(), -90 )
cam.Start3D2D(self:GetPos(),self:GetAngles(), 0.1)
draw.RoundedBox(0,-225,-225,450,450,Color(115,115,115,alpha*11-20))
draw.RoundedBox(4,-225,-247,450,30,Color(95,95,95, alpha*11-20))
draw.RoundedBox(4,-225,217,450,30,Color(95,95,95, alpha*11-20))
draw.RoundedBox(4,220,-220,5,450,Color(95,95,95, alpha*11-20))
draw.RoundedBox(4,-225,-225,5,450,Color(95,95,95, alpha*11-20))
local delay = 0
hook.Add( "Think", "CurTimeDelay", function()
if CurTime() < delay then return end
delay = CurTime() + 5
end)
if(ply:GetPos():Distance(self:GetPos()) < 150) then
draw.DrawText( "Hello there!", "TheDefaultSettings",value,0, Color( 255, 255, 255, alpha-10), TEXT_ALIGN_CENTER )
end
cam.End3D2D()
end
end
Sorry, you need to Log In to post a reply to this thread.