Jump to content

Moving DxDrawImage


h4x7o0r

Recommended Posts

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.

Link to comment

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") 
  

Link to comment

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.

Link to comment

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) 
  

Link to comment
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.

Link to comment

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.

Link to comment
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.

Link to comment

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

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