Jump to content

DX Animations


FlyingSpoon

Recommended Posts

Posted (edited)

If you mean moving a dxDraw "window" with some elements into it. It's a good way moving the window and fading in then the content.

Edited by Simple01

"Keep making it simplex."

Posted

Like I've said move the dxDrawRectangle and then fade in the dxDrawTexts with alpha interpolation or expand the text until it gets it's normal size, and if there are another dxDrawRectangles into a bigger dxDrawRectangle a good option to show them would be to expand them or to interpolate the alpha like on text.

"Keep making it simplex."

Posted (edited)

Well it's my first time using interpolate, not really sure where to start - 

addEventHandler("onClientRender", root,
    function()
        dxDrawRectangle(390, 173, 422, 424, tocolor(0, 0, 0, 217), false)
        dxDrawRectangle(390, 169, 422, 21, tocolor(52, 78, 208, 255), false)
        dxDrawText("Welcome to the server\nWelcome\nEnjoy\nSome random text", 424, 241, 752, 558, tocolor(255, 255, 255, 255), 1.00, "default", "left", "top", false, false, false, false, false)
    end
)

This is my code.

 

I want to swipe it in from the right to the centre.

Edited by raysmta
Posted
local tick, toggle

local x,y = guiGetScreenSize()

function togglethat()
   if not ( toggle ) then
     tick = getTickCount()
     toggle = true
   else
     toggle = false
   end
end
addCommandHandler( "toggleit", togglethat )

function renderAnim()
  if ( toggle ) then
    local p = ( getTickCount() - tick ) / 500
    x, y = interpolateBetween( guiGetScreenSize(), 0, 390, 173, 0, p, "Linear" )
  
  dxDrawRectangle( x, y, 422, 424, tocolor(0, 0, 0, 217), false)
  dxDrawRectangle( x, y - 4, 422, 21, tocolor(52, 78, 208, 255), false)
  dxDrawText("Welcome to the server\nWelcome\nEnjoy\nSome random text", x + 34, y + 68, x + 362, y + 317, tocolor(255, 255, 255, 255), 1.00, "default", "left", "top", false, false, false, false, false)
  end
end
addEventHandler("onClientRender", root, renderAnim )

Example script.

"Keep making it simplex."

Posted
local tick, toggle, x, y

local sx,sy = guiGetScreenSize()

function togglethat()
   if not ( toggle ) then
     tick = getTickCount()
     toggle = true
   else
     toggle = false
   end
end
addCommandHandler( "toggleit", togglethat )

function renderAnim()
  if ( toggle ) then
    local p = ( getTickCount() - tick ) / 500
    x, y = interpolateBetween( sx, sy, 0, 390, 173, 0, p, "Linear" )
  
  dxDrawRectangle( x, y, 422, 424, tocolor(0, 0, 0, 217), false)
  dxDrawRectangle( x, y - 4, 422, 21, tocolor(52, 78, 208, 255), false)
  dxDrawText("Welcome to the server\nWelcome\nEnjoy\nSome random text", x + 34, y + 68, x + 362, y + 317, tocolor(255, 255, 255, 255), 1.00, "default", "left", "top", false, false, false, false, false)
  end
end
addEventHandler("onClientRender", root, renderAnim )

 

"Keep making it simplex."

Guest
This topic is now closed to further replies.
  • Recently Browsing   0 members

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