Jump to content

How can i animate a gui?


Recommended Posts

  • Replies 52
  • Created
  • Last Reply

Top Posters In This Topic

this is my sample. Just edit guiSetAlphat to guiSetPosition.

bindKey("F3","down",function() 
     guiSetVisible(window,not guiGetVisible(window)) 
     guiSetAlpha( window, 0) 
     setTimer( 
     function() 
     guiSetAlpha( window, 0.1 ) 
     end 
     , 100, 1) 
     setTimer( 
     function() 
     guiSetAlpha( window, 0.2 ) 
     end 
     , 2000, 1) 
     setTimer( 
     function() 
     guiSetAlpha( window, 0.3 ) 
     end 
     , 300, 1) 
     setTimer( 
     function() 
     guiSetAlpha( window, 0.4 ) 
     end 
     , 400, 1) 
     setTimer( 
     function() 
     guiSetAlpha( window, 0.5 ) 
     end 
     , 500, 1) 
     setTimer( 
     function() 
     guiSetAlpha( window, 0.6 ) 
     end 
     , 600, 1) 
     setTimer( 
     function() 
     guiSetAlpha( window, 0.7 ) 
     end 
     , 700, 1) 
     setTimer( 
     function() 
     guiSetAlpha( window, 0.8 ) 
     end 
     , 800, 1) 
     setTimer( 
     function() 
     guiSetAlpha( window, 0.9 ) 
     end 
     , 900, 1) 
     setTimer( 
     function() 
     guiSetAlpha( window, 1 ) 
     end 
     , 1000, 0) 
     showCursor(guiGetVisible(window)) 
end) 

Link to comment

Thanks for that, Im using it differently for a spawn GUI though but thanks :)

Another question, How can i check if a gridlist already has a row with the same name? Like say i make a command /addrow [ROWNAME]

And then i type /addrow FWCentral then again i type /addrow FWCentral how can i check if there is already one to stop it?

Link to comment
I want a GUI to slide in from the side how can i do it?

Take a look at arc_'s client_anim library, it is located in the "race" resource.

Example of usage:

Animation.createAndPlay(pict, { from = 0, to = 100, time = 2000, fn = guiMove }) 

Where the 'pict' is an GUI element.

Link to comment
I don't need help with the sliding anymore thanks CapY, I need to know how to check if a gridlist row already contains the same text how can i do that??

Why would you check if there is already an equal row, just clear the gridlist and load the information again.

guiGridListClear 

Link to comment
Because im getting the data for the list from a DB and it creates the row even if its got the same names
guiGridListGetItemText 

An example:

if guiGridListGetItemText ( gridlist element, row, column ) == 'yourtext' then 
-- do stuff 

' == ' checks is it equal or not.

Link to comment

Ok that would work but when the gridlist first comes up its empty so i tried doing it like this;

  
addEvent("UpdateLocation",true) 
function updateLocations(location) 
local amount = guiGridListGetRowCount ( locationsList ) or 1 
for row = 1, amount do 
if guiGridListGetItemText ( locationsList, row, 1 ) == location then 
else 
local row = guiGridListAddRow(locationsList) 
guiGridListSetItemText ( locationsList, row, 1, location, false, false ) 
end 
end 
end 
addEventHandler("UpdateLocation", getLocalPlayer(),updateLocations) 
  

It doesn't give an error and doesn't show any rows :P

And Kenix i meant how could i make a table out of all the rows in the gridlist

Link to comment
addEvent ( "UpdateLocation", true ) 
function updateLocations ( location ) 
    local amount = guiGridListGetRowCount ( locationsList ) or 1 
    for row = 1, amount do 
        if ( guiGridListGetItemText ( locationsList, row, 1 ) ~= location ) then 
            local row = guiGridListAddRow ( locationsList ) 
            guiGridListSetItemText ( locationsList, row, 1, location, false, false ) 
        end 
    end 
end 
addEventHandler ( "UpdateLocation", localPlayer, updateLocations ) 

Link to comment
addEvent ( "UpdateLocation", true ) 
function updateLocations ( location ) 
    outputChatBox ( type ( location ) ..": ".. tostring ( location ) ) 
    local amount = guiGridListGetRowCount ( locationsList ) or 1 
    for row = 1, amount do 
        if ( guiGridListGetItemText ( locationsList, row, 1 ) ~= location ) then 
            local row = guiGridListAddRow ( locationsList ) 
            guiGridListSetItemText ( locationsList, row, 1, location, false, false ) 
        end 
    end 
end 
addEventHandler ( "UpdateLocation", localPlayer, updateLocations ) 

Tell me what does it output in the chat.

Link to comment

maybe here's the problem

 addEventHandler ( "UpdateLocation", localPlayer, updateLocations ) 

shouldn't it be like this?

 addEventHandler ( "UpdateLocation", getRootElement(), updateLocations )  

Edited by Guest
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...