h4x7o0r Posted May 23, 2013 Posted May 23, 2013 Hey there, I wanna move an image from one place to another (fade it as well ). For example: dxDrawImage(screenWidth - 90,156,64,64,"test.png",0.0,0.0,0.0,tocolor(255,255,255,200),false) --to be moved while fade it to : dxDrawImage(screenWidth - 90,50.0,63.0,62.0,"test.png",0.0,0.0,0.0,tocolor(255,255,255,200),false) I've imported the arc_ library but couldn't find any info regarding dx functions. How can i make it ? Thanks in advance for your help.
Castillo Posted May 24, 2013 Posted May 24, 2013 Just change the positions, define variables with them, then change them, you can use interpolateBetween to make a cooler effect.
h4x7o0r Posted May 24, 2013 Author Posted May 24, 2013 Thank you for your reply. i'm trying to figure it out how to define variables but can't get it. The examples in the wiki aren't helping me. Still digging. local screenWidth, screenHeight = guiGetScreenSize() local a , b = 50 , 100 dxDrawImage(screenWidth - 90,50 , a , b,"test.png",0.0,0.0,0.0,tocolor(255,255,255,200),false) local a , b = interpolateBetween ( a, b, 0, a+10, b+20, 0, progress, "Linear")
50p Posted May 24, 2013 Posted May 24, 2013 You're doing it almost right. Just move the interpolateBetween before you draw the image and use the returned values but don't use the same variable names like a and b because these are the returned values you want to use in dxDrawImage.
h4x7o0r Posted May 24, 2013 Author Posted May 24, 2013 Thanks for your reply 50p. like this ? local screenWidth, screenHeight = guiGetScreenSize() local a , b = 50 , 100 local a , b = interpolateBetween ( a1, b1, 0, a2+10, b2+20, 0, progress, "Linear") dxDrawImage(screenWidth - 90,50 , a , b,"test.png",0.0,0.0,0.0,tocolor(255,255,255,200),false)
Jacob Lenn Posted May 24, 2013 Posted May 24, 2013 local screenWidth, screenHeight = guiGetScreenSize() addEventHandler("onClientRender", root, function () local a , b = 50 , 100 local x, y = interpolateBetween ( a, b, 0, a+10, b+20, 0, progress, "Linear") dxDrawImage(screenWidth - 90,50 , a , b,"test.png",0.0,0.0,0.0,tocolor(255,255,255,200),false) end) You must also set value of this "progress". Check wiki, they have example about this.
h4x7o0r Posted May 24, 2013 Author Posted May 24, 2013 well it doesn't seems to work. just figure it out that i was changing the weight and height of the image and not the position. I've tried this but doesn't work : local screenWidth, screenHeight = guiGetScreenSize() addEventHandler("onClientRender", root, function () local a , b = 50 , 100 local x, y = interpolateBetween ( a, b, 0, a+10, b+20, 0, progress, "Linear") dxDrawImage( screenWidth - a, screenHeight - b , 63 , 62 ,"test.png",0.0,0.0,0.0,tocolor(255,255,255,200),false) end) I want the transition to appear when a resource is starting.
50p Posted May 24, 2013 Posted May 24, 2013 Do you get any warning messages? Check the debug window (/debugscript 3). If your progress variable is not set then you're probably getting an error message.
Jacob Lenn Posted May 24, 2013 Posted May 24, 2013 local screenWidth, screenHeight = guiGetScreenSize() local x = 0 addEventHandler("onClientRender", root, function () x = x + 0.01 local a , b = 50 , 100 local x, y = interpolateBetween ( a, b, 0, a+10, b+20, 0, x, "Linear") dxDrawImage( screenWidth - x, screenHeight - y , 63 , 62 ,"test.png",0.0,0.0,0.0,tocolor(255,255,255,200),false) end) Try this.
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