Jump to content

Moving DxDrawImage


h4x7o0r

Recommended Posts

Posted

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.

Posted

Just change the positions, define variables with them, then change them, you can use interpolateBetween to make a cooler effect.

San Andreas Utopia RPG (SAUR) Owner & Developer.

560x95_FFFFFF_FF9900_000000_000000.png

Education is the most powerful weapon which you can use to change the world.

Posted

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

Posted

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) 
  

Posted
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.

Posted

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.

Posted
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.

Posted

You're welcome.

San Andreas Utopia RPG (SAUR) Owner & Developer.

560x95_FFFFFF_FF9900_000000_000000.png

Education is the most powerful weapon which you can use to change the world.

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...