Jump to content

dxDrawText animation


Recommended Posts

So my idea is pretty easy, how can i make the dxText to be cut off by the bounding box? So if i make the bounding box enlarge or stretch it will cut off letters, but so far it just displays the text completly, while the rectangle shows slowly...

  
function RenderCreditStuff() 
--Check if not startup 
if not checkpoint then return end 
  
--Locals... 
local now = getTickCount() 
local duration = 5000 
local ending = start + duration 
local elapsed = now - start 
local progress = elapsed / duration 
  
if elapsed < 1000 then 
  
    --First Step Anim locals setup 
    local duration = 1000 
    local ending = start + duration 
    local elapsed = now - start 
    local progress = elapsed / duration 
         
        --First Step Anims 
        local x1 = interpolateBetween(0, 0,0, x*0.4,0,0, progress, "InQuad") 
        dxDrawRectangle(x*0.2, y*0.4, x1, y*0.1, tocolor(0,0,0,180)) 
         
elseif elapsed > 1000 and elapsed < 2000 then 
  
    --Second Step Anim locals setup 
    local duration = 1000 
    local start = start + 1000 
    local ending = start + duration 
    local elapsed = now - start 
    local progress = elapsed / duration 
         
        --First Step finished Anims 
        dxDrawRectangle(x*0.2, y*0.4, x*0.4, y*0.1, tocolor(0,0,0,180)) 
         
        --Second Step Anims 
        local x1 = interpolateBetween(0, 0,0, x*0.4,0,0, progress, "InQuad") 
        dxDrawText("Map: Unknown", x*0.2, y*0.4, x1, y*0.1,tocolor(255,255,255,255), 1, DxFont, "left", "top",true,false,true,true,true) 
        dxDrawRectangle(x*0.2, y*0.5, x1, y*0.1, tocolor(0,0,0,180)) 
         
else 
end 
end 
addEventHandler('onClientRender', root, RenderCreditStuff) 

Link to comment

I think you're giving dxDrawText the width and height of the rectangle, instead of it's right and bottom absolute coordinates.

Try this?

  
 dxDrawText("Map: Unknown", x*0.2, y*0.4, (x*0.2)+x1, (y*0.4)+(y*0.1),tocolor(255,255,255,255), 1, DxFont, "left", "top",true,false,true,true,true) 
  

Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...