TheWesty Posted December 20, 2022 Posted December 20, 2022 Quero fazer uma logo animada estilo fivem que no jogo fica sumindo e aparecendo lá em cima na tela
Human Resources Staff Vinyard Posted December 20, 2022 Human Resources Staff Posted December 20, 2022 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 Lord Henry Posted December 20, 2022 Other Languages Moderators Posted December 20, 2022 -- 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)
TheWesty Posted December 20, 2022 Author Posted December 20, 2022 MUITO OBRIGADO DEU CERTO VLW LORD HENRY
TheWesty Posted December 22, 2022 Author Posted December 22, 2022 Porém após umas horas ela para de piscar
Other Languages Moderators Lord Henry Posted December 22, 2022 Other Languages Moderators Posted December 22, 2022 13 hours ago, TheWesty said: Porém após umas horas ela para de piscar Dai é bug do MTA. Não do código.
TheWesty Posted December 22, 2022 Author Posted December 22, 2022 como posso colocar ela bem no topo da tela porque ela ta quase no meio
Other Languages Moderators Lord Henry Posted December 29, 2022 Other Languages Moderators Posted December 29, 2022 Ali na função do "onClientRender", altere os valores do fadeInImage e do fadeOutImage, como se fosse no dxDrawImage normal. 1
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now