FlyingSpoon Posted January 31, 2017 Posted January 31, 2017 How do I animate a couple of DX things together, like swipe smoothly from the right to the centre of the screen, any examples?
Simple0x47 Posted January 31, 2017 Posted January 31, 2017 It's mainly used to do anims.interpolateBetween
FlyingSpoon Posted January 31, 2017 Author Posted January 31, 2017 What if I want to move multiple DX, what would be the easiest way using this function?
Simple0x47 Posted January 31, 2017 Posted January 31, 2017 (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 January 31, 2017 by Simple01
FlyingSpoon Posted January 31, 2017 Author Posted January 31, 2017 dxDrawRectangles and some dxDrawText's
Simple0x47 Posted January 31, 2017 Posted January 31, 2017 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.
FlyingSpoon Posted January 31, 2017 Author Posted January 31, 2017 (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 January 31, 2017 by raysmta
Simple0x47 Posted January 31, 2017 Posted January 31, 2017 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.
FlyingSpoon Posted January 31, 2017 Author Posted January 31, 2017 21: attempt to perform arithemtic on upvalue 'y' (a nil value) 20: Bad argument @'dxDrawRectangle' [Expected vector2 at argument 1, got boolen] 18: Bad argument @'interpolateBetween' [Expected easing-type at argument 8, got none]
Simple0x47 Posted January 31, 2017 Posted January 31, 2017 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 )
Recommended Posts