Jump to content

InterpolateBetween


roaddog

Recommended Posts

Hey guys,

I got an issue with this function. in this case InterpolateBetween only execute when first time it renders, and after that

I didnt see it animated. I mean first time it renders, InterpolateBetween works but second, and so on, It doesnt

Anyone can help me out? Thank you

  
function whenTelp() 
    fadeCamera(false) 
    showChat(false) 
    addEventHandler("onClientRender", root, busmove) 
    setElementFrozen(localPlayer, true) 
    setTimer(function() 
        fadeCamera(true) 
        setElementFrozen(localPlayer, false) 
        showChat(true) 
        removeEventHandler("onClientRender", root, busmove) 
    end, 12000, 1) 
end 
  
function busmove() 
 progress = progress + step -- Increasing the progress each frame 
  if progress > 1 then -- Progress can't be more than 1 so let's limit it 
    progress = 1000 
  end 
    py = interpolateBetween(-500,sy/2-ssy/2,0,sy/2-(470/ry)*sy/2,0,0,progress,"OutElastic") 
    dxDrawImage((268/rx)*sx, py, (183/rx)*sx, (180/ry)*sy, "bus.png", 0, 0, 0, tocolor(254, 254, 254, 255), true) 
end 

Link to comment
  • MTA Team
  
function whenTelp() 
    progress = 0 -- Added this 
    fadeCamera(false) 
    showChat(false) 
    addEventHandler("onClientRender", root, busmove) 
    setElementFrozen(localPlayer, true) 
    setTimer(function() 
        fadeCamera(true) 
        setElementFrozen(localPlayer, false) 
        showChat(true) 
        removeEventHandler("onClientRender", root, busmove) 
    end, 12000, 1) 
end 

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