Jump to content

LOGO FIVEM


Recommended Posts

  • Human Resources Staff
Posted

Hi,

Your thread has been moved to the Portuguese section so you can get better assistance in your native language.
Make sure to always use English when posting outside this language-specific section!

  • Other Languages Moderators
Posted
-- 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)

 

  • Other Languages Moderators
Posted
13 hours ago, TheWesty said:

Porém após umas horas ela para de piscar 

Dai é bug do MTA. Não do código.

  • Other Languages Moderators
Posted

Ali na função do "onClientRender", altere os valores do fadeInImage e do fadeOutImage, como se fosse no dxDrawImage normal.

  • Thanks 1

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