Jump to content

interpolateBetween help


Recommended Posts

Hello! I have a script about a scoreboard. It has animation in it, but only when it appears. How can I make it animate when I release the button? So the same animation plays, but from the end position to the start position.

  
showing = false 
local easing = "OutElastic" 
local tick = getTickCount() 
function rendering() 
    local endTime = tickk + 500 
    local term = tick - tickk 
    local perm = endTime - tickk 
    local progress = term/perm 
    local recintw, recinth, _ = interpolateBetween(x, y, 0, recw, rech, 0, progress, easing) 
    local recintx, recinty, _ = interpolateBetween(0, 0, 0, recx, recy, 0, progress, easing) 
  
... 
  
-- Here's the part of pushing and releasing tab, and what I tried to animate it when it disappears, but it's not working 
  
bindKey("tab", "both", function(key, state) 
    if state == "down" and not showing then 
        tickk = getTickCount() 
        addEventHandler("onClientRender", root, performRender) 
        showing = true 
        g_oldControlStates = {} 
        for k, control in ipairs ( controls ) do 
            g_oldControlStates[k] = isControlEnabled ( control ) 
            toggleControl ( control, false ) 
        end 
        showChat(false) 
    elseif state == "up" and showing then 
        local eastype = "OutElastic" 
        tickk = getTickCount() 
        local endTime = tickk + 500 
        local term = tick - tickk 
        local perm = endTime - tickk 
        local progress = term/perm 
        interpolateBetween(recx, recy, 0, 0, 0, 0, progress, easing) 
        showing = false 
        removeEventHandler("onClientRender", root, performRender) 
        showChat(true) 
        for k, control in ipairs ( controls ) do 
            toggleControl ( control, g_oldControlStates[k] ) 
        end 
    end 
end) 
  
  

So, how could I make it animated at disappearing / releasing TAB?

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