Jump to content

LOGO FIVEM


Recommended Posts

  • Other Languages Moderators
-- FUNÇÕES ÚTEIS
function fadeInImage (posX, posY, sizeX, sizeY, texture, rotation, rotationCenterOffsetX, rotationCenterOffsetY, r, g, b, postGUI, theDuration, theType, thePeriod, theAmplitude, theOvershoot)
    local start = getTickCount()
    function renderIn ()
        local now = getTickCount()
        local endTime = start + theDuration
        local elapsedTime = now - start
        local duration = endTime - start
        local progress = elapsedTime / duration
        local a = interpolateBetween (0, 0, 0, 255, 0, 0, progress, theType, thePeriod, theAmplitude, theOvershoot)
        dxDrawImage (posX, posY, sizeX, sizeY, texture, rotation, rotationCenterOffsetX, rotationCenterOffsetY, tocolor (r, g, b, a), postGUI)
    end
    addEventHandler ("onClientRender", root, renderIn)
end

function fadeOutImage (posX, posY, sizeX, sizeY, texture, rotation, rotationCenterOffsetX, rotationCenterOffsetY, r, g, b, postGUI, theDuration, theType, thePeriod, theAmplitude, theOvershoot)
    local start = getTickCount()
    removeEventHandler ("onClientRender", root, renderIn)
    function renderOut ()
        local now = getTickCount()
        local endTime = start + theDuration
        local elapsedTime = now - start
        local duration = endTime - start
        local progress = elapsedTime / duration
        local a = interpolateBetween (255, 0, 0, 0, 0, 0, progress, theType, thePeriod, theAmplitude, theOvershoot)
        dxDrawImage (posX, posY, sizeX, sizeY, texture, rotation, rotationCenterOffsetX, rotationCenterOffsetY, tocolor (r, g, b, a), postGUI)
    end
    addEventHandler ("onClientRender", root, renderOut)
    setTimer (function()
        removeEventHandler ("onClientRender", root, renderOut)
    end, theDuration+100, 1)
end

-- CÓDIGO EM SI
local screen = Vector2(guiGetScreenSize()) -- É o mesmo que: local screen.x, screen.y = guiGetScreenSize()
local tempoAtivo = 3000 -- Tempo com a imagem visível. Não pode ser menor que o tempo da animação.
local tempoOculto = 1000 -- Tempo com a imagem invisível. Não pode ser menor que o tempo da animação.
local tempoAnimation = 1000 -- Tempo que cada fade demora para ser completado.
local logo = dxCreateTexture ("image.png", "argb", false, "clamp") -- Aqui você coloca o nome da imagem da sua logo onde está "logo.png"

addEventHandler ("onClientResourceStart", resourceRoot, function () -- Aqui é como se fosse dxDrawImage normal, só que vai incluir a duração da animação e easing da animação, por padrão usamos "Linear".
    fadeInImage (screen.x/2 - 100, 10, 200, 200, logo, 0, 0, 0, 255, 255, 255, true, tempoAnimation, "Linear")
    setTimer (fadeOutImage, tempoAtivo, 1, screen.x/2 - 100, 10, 200, 200, logo, 0, 0, 0, 255, 255, 255, true, tempoAnimation, "Linear")
    setTimer (function ()
        fadeInImage (screen.x/2 - 100, 10, 200, 200, logo, 0, 0, 0, 255, 255, 255, true, tempoAnimation, "Linear")
        setTimer (fadeOutImage, tempoAtivo, 1, screen.x/2 - 100, 10, 200, 200, logo, 0, 0, 0, 255, 255, 255, true, tempoAnimation, "Linear")
    end, tempoAtivo+tempoOculto, 0)
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...