Karuzo Posted January 31, 2014 Share Posted January 31, 2014 Hey Guys, i'm trying to make my Rectangle more beautiful, so i used dxDrawAnimWindow. Ok, the Window works and is animated. So whats the problem ? I have a text , i want that the text makes also the animation. But don't know how.. Could you help me ? Code: local gRoot = getRootElement() local screenW, screenH = guiGetScreenSize() function dxDrawAnimWindow(text,height,width,color,font,anim) local x,y = guiGetScreenSize() btwidth = width btheight = height/20 local now = getTickCount() local elapsedTime = now - start local endTime = start + 1500 local duration = endTime - start local progress = elapsedTime / duration local x1, y1, z1 = interpolateBetween ( 0, 0, 0, width, height, 255, progress, anim) local x2, y2, z2 = interpolateBetween ( 0, 0, 0, btwidth, btheight, btheight/11, progress, anim) posx = (x/2)-(x1/2) posy = (y/2)-(y1/2) dxDrawRectangle ( posx, posy-y2, x2, y2, color ) dxDrawRectangle ( posx, posy, x1, y1, tocolor ( 0, 0, 0, 200 ) ) dxDrawText ( text, 0, -(y1)-y2, x, y, tocolor ( 255, 255, 255, 255 ), z2,font,"center","center") end function content() local color = tocolor ( 0, 0, 0, 255 ) dxDrawAnimWindow ( "ExampleWindow",500,600, color, "default-bold", "OutBounce") dxDrawText("Example", (screenW - 190) / 2, (screenH - 75) / 4, ((screenW - 190) / 2) + 190, ( (screenH - 75) / 4) + 75, tocolor(255, 255, 255, 255), 1.00, "sans", "left", "top", false, false, false, false, false) end function open() opened = not opened if opened == true then start = getTickCount() addEventHandler ( "onClientRender", gRoot, content ) else removeEventHandler("onClientRender", gRoot, content ) end end bindKey("F2","down",open) Link to comment
MTA Team 0xCiBeR Posted January 31, 2014 MTA Team Share Posted January 31, 2014 Just put the dxDraw in the usfull function, and use the same interpolation effects. Link to comment
Karuzo Posted January 31, 2014 Author Share Posted January 31, 2014 I don't really understand what you're trying to tell me. Could you explain please what you mean ? Link to comment
MTA Team 0xCiBeR Posted January 31, 2014 MTA Team Share Posted January 31, 2014 local gRoot = getRootElement() local screenW, screenH = guiGetScreenSize() function dxDrawAnimWindow(text,height,width,color,font,anim) local x,y = guiGetScreenSize() btwidth = width btheight = height/20 local now = getTickCount() local elapsedTime = now - start local endTime = start + 1500 local duration = endTime - start local progress = elapsedTime / duration local x1, y1, z1 = interpolateBetween ( 0, 0, 0, width, height, 255, progress, anim) local x2, y2, z2 = interpolateBetween ( 0, 0, 0, btwidth, btheight, btheight/11, progress, anim) posx = (x/2)-(x1/2) posy = (y/2)-(y1/2) dxDrawRectangle ( posx, posy-y2, x2, y2, color ) dxDrawRectangle ( posx, posy, x1, y1, tocolor ( 0, 0, 0, 200 ) ) dxDrawText ( text, 0, -(y1)-y2, x, y, tocolor ( 255, 255, 255, 255 ), z2,font,"center","center") dxDrawText ( "Example", 0, -(y1)-y2, x, y, tocolor ( 255, 255, 255, 255 ), z2,font,"center","center")--Here you add the new dxDraw just fix the coords. end function content() local color = tocolor ( 0, 0, 0, 255 ) dxDrawAnimWindow ( "ExampleWindow",500,600, color, "default-bold", "OutBounce") end function open() opened = not opened if opened == true then start = getTickCount() addEventHandler ( "onClientRender", gRoot, content ) else removeEventHandler("onClientRender", gRoot, content ) end end bindKey("F2","down",open) Link to comment
Karuzo Posted January 31, 2014 Author Share Posted January 31, 2014 Sorry for the stupid question but , which coordinates do you mean ? Link to comment
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now