Jump to content

Gif image


Recommended Posts

Hello,

I have a script that makes a image moving from the top of your screen to the middle of your screen.

But i was wondering if it is possible to change the image to a gif?

  
local screenWidth, screenHeight = guiGetScreenSize() 
local startPos = {0.4, 0.0} --the relative position from where the image will start 
local endPos = {0.4, 0.5} --the relative position from where the image will stop 
local animType = "OutBounce" --the animation type, see [url=https://wiki.multitheftauto.com/wiki/Easing]https://wiki.multitheftauto.com/wiki/Easing[/url] 
local speed = 0.5 --the speed of the entire animation 
local hideTime = 7 --time in sec after the dead image will hidden (starting from the end of the anim) 
local animStep = 0 --do not modify, used to hold the progression of the animation 
local stopingTimer = nil  
--the distance between the line and the top of the image 
local lOffsetY = 0.07*screenHeight 
  
  
  
function animateDeadImage() 
    local x, y, _ = interpolateBetween( 
        startPos[1]*screenWidth, startPos[2]*screenHeight, 0, 
        endPos[1]*screenWidth, endPos[2]*screenHeight, 0, animStep/100, animType) 
  
  
    dxDrawImage(x, y, 250, 250, 'image/intro.png', 0, 0, -120) 
  
    animStep = animStep + speed --steping the animation 
    if animStep >= 100 and not stopingTimer then 
        stopingTimer = setTimer(hideDeadImage, hideTime*1000, 1) --start the timer to make hide it 
    end 
end 
  
function hideDeadImage() 
    removeEventHandler("onClientRender", root, animateDeadImage) 
    stopingTimer = nil --reset it for our condition 
end 
  
function cursorMove ( _, _, x, y ) 
    if ( isCursorShowing ( ) and not guiGetVisible ( window ) and isOpen) then 
        if ( x >= pX+156 and x <= pX+246 and y >=  pY+170 and y <=  pY+200 ) then 
            data.login.hovering = true 
            return 
        elseif ( y >=  pY+170 and y <=  pY+200 and x >= pX+300 and x <= pX+440 ) then 
            data.reg.hovering = true 
            return 
        end 
    end 
    data.login.hovering = false 
    data.reg.hovering = false 
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...