local screenSize = Vector2(guiGetScreenSize())
local bAllValid = false
local logoTexture
local logoSize
local logoPosition
local circleTexture
local circleSize = {}
local circlePosition = {}
local BACKGROUND_COLOR = 0xFF151515
local CIRCLE_COLOR = {214, 0, 101} --{0, 200, 200} --
local CIRCLE_COLOR2 = {66, 30, 131} --{0, 70, 70} --
local CIRCLE_ANIM_TIME = 1000
local CIRCLE_ANIM_DELAY = 100
local CIRCLES_OFFSET = 0
local MIN_CIRCLE_SIZE = 30
local MAX_CIRCLE_SIZE = 110
local CIRCLE_COUNT = 50
local imgColor = {255,255,255}
local screenW,screenH = guiGetScreenSize()
local resW, resH = 1600,900
local x, y = (screenW/resW), (screenH/resH)
local screenWidth, screenHeight = guiGetScreenSize()
local webBrowser = createBrowser(screenWidth, screenHeight, false, false)
function webBrowserRender()
dxDrawImage(x0, y0, x1600, y900, webBrowser, 0, 0, 0, tocolor(255,255,255,255), true)
end
addEventHandler("onClientBrowserCreated", webBrowser,
function()
loadBrowserURL(webBrowser, "https://www.youtube.com/embed/6MNxuMgg58k?autoplay=1&controls=0&loop=1&showinfo=0%22)
addEventHandler("onClientRender", root, webBrowserRender)
end
)
local function draw()
dxSetBlendMode("modulate_add")
dxDrawRectangle(0, 0, screenSize, BACKGROUND_COLOR)
for i = 1, CIRCLE_COUNT do
local circleAnimProgress = getEasingValue(math.abs(math.sin((getTickCount() - (CIRCLE_ANIM_DELAY * i)) / CIRCLE_ANIM_TIME)), "InQuad")
local size = MIN_CIRCLE_SIZE + (MAX_CIRCLE_SIZE - MIN_CIRCLE_SIZE) * circleAnimProgress
circleSize[i] = Vector2(size, size)
local color = tocolor(interpolateBetween(CIRCLE_COLOR[1], CIRCLE_COLOR[2], CIRCLE_COLOR[3], CIRCLE_COLOR2[1], CIRCLE_COLOR2[2], CIRCLE_COLOR2[3], circleAnimProgress, "InQuad"))
dxDrawImage(circlePosition[i] - circleSize[i] / 2, circleSize[i], circleTexture, 0, 0, 0, color)
end
local circleAnimProgress = getEasingValue(math.abs(math.sin((getTickCount() - (CIRCLE_ANIM_DELAY )) / 5000)), "OutInBounce")
local alph = 120 + (255 - 120) * circleAnimProgress
dxDrawImage(logoPosition, logoSize, logoTexture, 0, 0, 0, tocolor(imgColor[1],imgColor[2],imgColor[3],alph))
dxSetBlendMode("blend")
end
function hide()
removeEventHandler("onClientRender", root, draw)
removeEventHandler("onClientRender", root, webBrowser)
end
addEventHandler("onClientResourceStart", resourceRoot, function ()
if not localPlayer:getData("username") then
logoTexture = dxCreateTexture("assets/logo.png")
dxSetTextureEdge(logoTexture, "clamp")
logoSize = Vector2(logoTexture:getSize())
logoPosition = Vector2(screenSize.x / 2 - logoSize.x / 2, screenSize.y / 2 - logoSize.y / 1.5)
circleTexture = dxCreateTexture("assets/circle.png")
for i = 1, CIRCLE_COUNT do
circlePosition[i] = Vector2(screenSize.x / CIRCLE_COUNT + (screenSize.x / CIRCLE_COUNT * (i - 1)), screenSize.y - CIRCLES_OFFSET)
end
end
end)
function thisShader2()
bAllValid = true
end
setTimer(function()
if isTransferBoxActive() then
if not bAllValid then
addEventHandler("onClientRender", root, thisShader2)
addEventHandler("onClientRender", root, draw, true, "high")
addEventHandler("onClientRender", root, webBrowser, true, "high")
end
else
if bAllValid then
removeEventHandler("onClientRender", root, thisShader2)
removeEventHandler("onClientRender", root, draw)
removeEventHandler("onClientRender", root, webBrowser)
bAllValid = false
end
bAllValid = false
end
end, 100, 0)
opa, estou programando uma loadingscreen e gostaria da ajuda de vocês para fazer ela funcionar corretamente. na teoria ela deveria abrir o browser quando o player estivesse fazendo o download e fechar quando ele terminar, porem não está funcionando help