Jump to content

[Help] DX animations


Artenos

Recommended Posts

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

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

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:

x8pznTh.png?1

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

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