Jump to content

Requesting to know things


Recommended Posts

How to make Shadows when you move the mouse to the button and when you click on it?

How to make the Dx texts don't be on the screen in 1 second...like for example the words starts to move about 5 seconds to reach to the place and stop..like moving objects :) or like the words are hidden and be shown slowly? ? ?

THANKS A LOT!

Link to comment
I didn't understand the shadow part.

About the moving text, you can either define variables with the position and update it to make it "move", or you can use interpolateBetween to make a nice and smooth effect.

Alright about Shadow part i mean that: When you move the cursor of the mouse to the button, it makes a Black shadow on it like stand by for clicking..i hope you understand :) ... or when you put the mouse on the button without clicking on it the button starts to move up like object but not move up high...just move 1 cm or less...i hope you understand.

Link to comment
I didn't understand the shadow part.

About the moving text, you can either define variables with the position and update it to make it "move", or you can use interpolateBetween to make a nice and smooth effect.

I've Checked interpolateBetween's Examples but Really long and didn't understand them well, could you give an simple example ? :) please.

inerpolateBetween is kind of an advanced function... This is what I use in my login though:

    local intData = { 
    start = { 0, 0 }, 
    _end = { 485, 231 }, 
    startTime = nil, 
    endTime = nil, 
    alpha = 0 
} 
  
-- this is in onClientRender 
    if not intData.startTime then 
        intData.startTime = getTickCount ( ) 
        intData.endTime = getTickCount ( ) + 1500 
        intData.isDone = false 
    end 
     
    if ( isOpen ) then 
        local now = getTickCount ( ) 
        local elapsedTime = now - intData.startTime 
        local duration = intData.endTime - intData.startTime 
        local progress = elapsedTime / duration 
         
        local start = intData.start 
        local _end = intData._end 
        local w, h, _ = interpolateBetween ( start[1], start[2], 0, _end[1], _end[2], 0,  progress, "OutBounce" ) 
         

and to make the shadow when the cursor is over DX text, you can use:

getCursorPosition 

check the x and y axis, and if it's in the text, then draw a dx text in the background, behind the current text.

https://community.multitheftauto.com/index.php?p= ... ls&id=7970 -> This resource may help you

Link to comment
I didn't understand the shadow part.

About the moving text, you can either define variables with the position and update it to make it "move", or you can use interpolateBetween to make a nice and smooth effect.

I've Checked interpolateBetween's Examples but Really long and didn't understand them well, could you give an simple example ? :) please.

inerpolateBetween is kind of an advanced function... This is what I use in my login though:

    local intData = { 
    start = { 0, 0 }, 
    _end = { 485, 231 }, 
    startTime = nil, 
    endTime = nil, 
    alpha = 0 
} 
  
-- this is in onClientRender 
    if not intData.startTime then 
        intData.startTime = getTickCount ( ) 
        intData.endTime = getTickCount ( ) + 1500 
        intData.isDone = false 
    end 
     
    if ( isOpen ) then 
        local now = getTickCount ( ) 
        local elapsedTime = now - intData.startTime 
        local duration = intData.endTime - intData.startTime 
        local progress = elapsedTime / duration 
         
        local start = intData.start 
        local _end = intData._end 
        local w, h, _ = interpolateBetween ( start[1], start[2], 0, _end[1], _end[2], 0,  progress, "OutBounce" ) 
         

and to make the shadow when the cursor is over DX text, you can use:

getCursorPosition 

check the x and y axis, and if it's in the text, then draw a dx text in the background, behind the current text.

https://community.multitheftauto.com/index.php?p= ... ls&id=7970 -> This resource may help you

Not really with some decent idea and pacience: lets explain him this way (how i did with my friend who started lua short time ago)

Interpolate gives a number wich is in a point between your values selected (1, 2, 3) specified by progress, in a curve or "Way" its defined (usually "Linear" is pretty self expainatory)

Note: Progress is from 0 to 1 (0.5 = 50%)

So;

  
local Val1, Val2, Val3 = interPolateBetween(BaseVal1, BaseVal2, BaseVal3, EndVal1, EndVal2, EndVal3, Progress, "Linear") 
  

Supposing BaseVal1 is 0 and EndVal1 is 100 then a progress of 0.5 will return Val1 = 50.

Normally onClientRender is used inside interpolate funcions to make them smooth, i lastly combined it with timers, works pretty well. (thought this might be a bit more advanced and complicated, it works pretty well, it is taken from my 3D text function for my gamemode).

Note: This makes the text "Flash" like a heart meter (bigger, smaller, bigger, etc) and some variables are not present becouse its just a part of it)

  
InterTimer = setTimer(function() 
                    if val1 == 50 then 
                    val1 = 100 
                    val2 = 50 
                    else 
                    val1 = 50 
                    val2 = 100 
                    end 
                    end, 500, 0) 
  
function DrawRender() 
local rem, asd, asd2 = getTimerDetails(InterTimer) 
local p = rem / 500 
local v1,v2,v3 = interpolateBetween(val1, 0,0, val2, 0,0, p, "Linear") 
local MyScale = ( v1 / 100 ) * 1.3 
local scx2, scy2 = getScreenFromWorldPosition ( PedX, PedY, PedZ + 1, -50, true ) 
local alpha2 = 255 
dxDrawText ( "#66ffaaPress #ffffffF #66ffaaTo join", scx2, scy2, scx2, scy2, tocolor ( r, g, b, alpha2 ), MyScale, font, "center", "center",false,false,false,true ) 
addEventHandler("onClientRender", getRootElement(), DrawRender) 
  

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