Artenos Posted August 24, 2015 Share Posted August 24, 2015 Hello, so I'm using PaiN^'s [GIE] GUI Interpolate Effects resource (https://forum.multitheftauto.com/viewtopic.php?f=108&t=64608/viewtopic.php?f=108&t=64608) to add animations to my dxrectangle but everytime I run the script it outputs "Not GUI Element" does this mean it doesn't work with dx? if so is there any other way to give simple animations to dx elements? this is the code local screenW, screenH = guiGetScreenSize() ------start---------------- startX = screenW * 0.6486 startY = screenH * 0.4583 startW = screenW * 0.1208 startH = screenH * 0.3151 -----end------------------- endX = screenW * 0.8367 endY = screenH * 0.4583 endW = screenW * 0.1208 endH = screenH * 0.3151 addEventHandler("onClientResourceStart", resourceRoot, function() rec1 = dxDrawRectangle(screenW * 0.6486, screenH * 0.4583, screenW * 0.1208, screenH * 0.3151, tocolor(255, 255, 255, 255), false) exports.gie.guiAddInterpolateEffect( rec1, startX, startY, startW, startH, endX, endY, endW, endH, 5, Linear, Linear, 1 ) end ) Link to comment
Moderators IIYAMA Posted August 24, 2015 Moderators Share Posted August 24, 2015 Atenos, what does dxDrawRectangle return? You can find the answer here: https://wiki.multitheftauto.com/wiki/DxDrawRectangle Which is also the answer why it doesn't work. Link to comment
MAB Posted August 25, 2015 Share Posted August 25, 2015 Hello, so I'm using PaiN^'s [GIE] GUI Interpolate Effects resource (https://forum.multitheftauto.com/viewtopic.php?f=108&t=64608/viewtopic.php?f=108&t=64608) to add animations to my dxrectangle but everytime I run the script it outputs "Not GUI Element" does this mean it doesn't work with dx? if so is there any other way to give simple animations to dx elements? this is the code local screenW, screenH = guiGetScreenSize() ------start---------------- startX = screenW * 0.6486 startY = screenH * 0.4583 startW = screenW * 0.1208 startH = screenH * 0.3151 -----end------------------- endX = screenW * 0.8367 endY = screenH * 0.4583 endW = screenW * 0.1208 endH = screenH * 0.3151 addEventHandler("onClientResourceStart", resourceRoot, function() rec1 = dxDrawRectangle(screenW * 0.6486, screenH * 0.4583, screenW * 0.1208, screenH * 0.3151, tocolor(255, 255, 255, 255), false) exports.gie.guiAddInterpolateEffect( rec1, startX, startY, startW, startH, endX, endY, endW, endH, 5, Linear, Linear, 1 ) end ) yes it is not working with dx elements it works with gui elements only so if you want to make animations on the dx element you must use interpolateBetween if you are interested in dx elements you can check my DirectX GUI tutorial Link to comment
LoOs Posted August 25, 2015 Share Posted August 25, 2015 example : # local start = getTickCount() local one, one1 = 0, 0 local two, two1 = 750, 680 addEventHandler("onClientRender", root, function() local now = getTickCount() local width, height = interpolateBetween(one, one1, 0, two, two1, 0, (now - start) / ((start + 1500) - start), "Linear") dxDrawRectangle(319, 109, width, height, tocolor(0, 0, 0, 130), false) end) Link to comment
Artenos Posted August 26, 2015 Author Share Posted August 26, 2015 Thank you for the help guys example : # local start = getTickCount() local one, one1 = 0, 0 local two, two1 = 750, 680 addEventHandler("onClientRender", root, function() local now = getTickCount() local width, height = interpolateBetween(one, one1, 0, two, two1, 0, (now - start) / ((start + 1500) - start), "Linear") dxDrawRectangle(319, 109, width, height, tocolor(0, 0, 0, 130), false) end) How would I do it so that it slides instead like this: Link to comment
LoOs Posted August 26, 2015 Share Posted August 26, 2015 Thank you for the help guys example : # local start = getTickCount() local one, one1 = 0, 0 ---- The coordinates of the beginning local two, two1 = 750, 680 ---- The coordinates of the end addEventHandler("onClientRender", root, function() local now = getTickCount() local width, height = interpolateBetween(one, one1, 0, two, two1, 0, (now - start) / ((start + 1500) - start), "Linear") dxDrawRectangle(319, 109, width, height, tocolor(0, 0, 0, 130), false) end) easy : # local start = getTickCount() local one, one1 = 0, 0 ---- The coordinates of the beginning local two, two1 = 319, 109 ---- The coordinates of the end addEventHandler("onClientRender", root, function() local now = getTickCount() local x,y = interpolateBetween(one, one1, 0, two, two1, 0, (now - start) / ((start + 1500) - start), "Linear") dxDrawRectangle(x,y, 680, 750, tocolor(0, 0, 0, 130), false) end) Link to comment
Artenos Posted August 26, 2015 Author Share Posted August 26, 2015 Thank you for the help guys example : # local start = getTickCount() local one, one1 = 0, 0 ---- The coordinates of the beginning local two, two1 = 750, 680 ---- The coordinates of the end addEventHandler("onClientRender", root, function() local now = getTickCount() local width, height = interpolateBetween(one, one1, 0, two, two1, 0, (now - start) / ((start + 1500) - start), "Linear") dxDrawRectangle(319, 109, width, height, tocolor(0, 0, 0, 130), false) end) easy : # local start = getTickCount() local one, one1 = 0, 0 ---- The coordinates of the beginning local two, two1 = 319, 109 ---- The coordinates of the end addEventHandler("onClientRender", root, function() local now = getTickCount() local x,y = interpolateBetween(one, one1, 0, two, two1, 0, (now - start) / ((start + 1500) - start), "Linear") dxDrawRectangle(x,y, 680, 750, tocolor(0, 0, 0, 130), false) end) I get it now the x,y and the width and height can be manipulated by the interpolate effect, easy enough. Thanks dude!. 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