Zaloguj się by uzyskać pełen dostęp. Nie masz jeszcze konta? Założ je już teraz w kilka sekund.

Wysłany: 2021-03-15, 14:39


NoNamik







Wiek: 35
Na forum: 2186 dni
Posty: 289
Nick w MP: JestemNoNamem

Piwa: 374

Respekt: 60

Witam chcialem zrobic animowane ogloszenia zeby sie wysuwaly i wsuwaly lecz jestem zielony w temacie animacji w mta


local start getTickCount()
function isEventHandlerAddedsEventNamepElementAttachedTofunc )
    if 
        typesEventName ) == 'string' and 
        isElementpElementAttachedTo ) and 
        typefunc ) == 'function' 
    then
        local aAttachedFunctions getEventHandlerssEventNamepElementAttachedTo )
        if typeaAttachedFunctions ) == 'table' and #aAttachedFunctions > 0 then
            for iv in ipairsaAttachedFunctions ) do
                if == func then
                    return true
                end
            end
        end
    end
 
    return false
end

foNte dxCreateFont(":im_dx/f/Roboto-Bold.ttf",9) or "default-bold"

l={}
function hud()
x,guiGetScreenSize()
screenW,screenH guiGetScreenSize()
 for k,v in ipairs getElementsByType "object" ) ) do
    if getElementData v"ogloszenie" then
        local tekst getElementData v"tekstogloszenia" )
        local width dxGetTextWidth(tekst,1,"default-bold")
        local now getTickCount()
            local endTime start 2000
        local elapsedTime now start
        local duration endTime start

        local progress elapsedTime duration
        
        if progress and progress 4 then
        if not s then
        s getTickCount()
        end
        return end
     dxDrawImage(screenW 0.0005screenH 0.5213screenW 0.1323screenH 0.0546":pystories-admin/ogloszenie.png"000tocolor(255255255255), false)
        dxDrawText(tekstscreenW 0.0286screenH 0.5213screenW 0.1255screenH 0.5759tocolor(255255255255), 1.00"default-bold""center""center"falsetruefalsetruefalse)
    --    dxDrawText(tekst,xtyt,screenW 0.6382screenH 0.8555tocolor(255,255,255255), 1.00foNte"center""top"falsetruefalsetruefalse)
    end
end
end

function roundedRectangle(xywhborderColorbgColorpostGUI)
    if (and and and hthen
        if (not borderColorthen
            borderColor tocolor(000200);
        end
        
        if (not bgColorthen
            bgColor borderColor;
        end
        
        --> Background
        --dxDrawRectangle(xywhbgColorpostGUI);
        
        --> Border
        --dxDrawRectangle(2141borderColorpostGUI); -- top
        --dxDrawRectangle(2h41borderColorpostGUI); -- bottom
        --dxDrawRectangle(1214borderColorpostGUI); -- left
        --dxDrawRectangle(w214borderColorpostGUI); -- right
    end
end


addEventHandler "onClientElementDataChange"root, function(data,old)
    if getElementType(source) == "object" and data == "ogloszenie" then
        if getElementData(source,"ogloszenie"then
            if isEventHandlerAdded("onClientRender",root,hudthen
                removeEventHandler "onClientRender"roothud)
            end
            l={math.random(0,255),math.random(0,255),math.random(0,255)}
                        czas getTickCount()
            start getTickCount()
            nil
            addEventHandler "onClientRender"roothud)
        else
            removeEventHandler "onClientRender"roothud)
                        czas getTickCount()
            start getTickCount()
            nil
            l={}
        end
    end
end)
addEventHandler "onClientRender"roothud)


Postaw piwo autorowi tego posta
 

 
Więcej szczegółów
Wystawiono 1 piw(a):
borsuk
Wysłany: 2021-03-15, 15:07


xyzzz^

A nic






Wiek: 18
Na forum: 1993 dni
Posty: 319
Nick w MP: Aspyk21

Piwa: 308

Respekt: 81

Ostrzeżeń: 100%

Więcej informacji znajdziesz w Wikipedii MTA:

interpolateBetween


Postaw piwo autorowi tego posta
 

 
Więcej szczegółów
Wystawiono 1 piw(a):
borsuk
Wysłany: 2021-03-15, 16:37


NoNamik







Wiek: 35
Na forum: 2186 dni
Posty: 289
Nick w MP: JestemNoNamem

Piwa: 374

Respekt: 60

xyzzz^, tyle to ja wiem

[ Dodano: 2021-03-15, 16:39 ]
xyzzz^, tylko mi chodzi o to by to sie animowalo jak w notyfikacja a jak patrze na kod notyfikacji to totalnie nie wiem co jest grane w nim

[ Dodano: 2021-03-15, 17:32 ]
zrobilem tak dziala animacja imaga ale tekst gdzies z gory przylatuje
Kod:

local x, y, z = interpolateBetween (screenW * 0.0000, screenH * 0.5213, 0, screenW * 1.2, screenH * 0.5226 , 0, (s-getTickCount())/(( s + 2000 ) - s ), "InOutBack")
local x2, y2, z2 = interpolateBetween (screenW * 0.0302, screenH * 0.5222, 0, screenW * 0.1281, screenH * 0.5750, 0, progress, "InOutBack")


dxDrawImage(x, y, screenW * 0.1323, screenH * 0.0546, ":pystories-admin/ogloszenie.png", 0, 0, 0, tocolor(255, 255, 255, 255), false)
dxDrawText(tekst,x2, y2, screenW * 0.1281, screenH * 0.5750, tocolor(255, 255, 255, 255), 1.00, foNte, "center", "top", false, true, false, false, false)
return end
local px, py, pz = getElementPosition(localPlayer)
local x, y, z = interpolateBetween (screenW * -0.2000, screenH * 0.5213, 0, screenW * 0.0022, screenH * 0.5226, 0, progress, "InOutBack")
local x2, y2, z2 = interpolateBetween (screenW * -0.0661, screenH * 0.5222, 0, screenW * 0.0000, screenH * 0.5750, 0, progress, "InOutBack")

dxDrawImage(x, y, screenW * 0.1323, screenH * 0.0546, ":pystories-admin/ogloszenie.png", 0, 0, 0, tocolor(255, 255, 255, 255), false)
--dxDrawRectangle(x, y, screenW * 0.2500 , screenH * 0.0365 + (width * 0.05), tocolor(0, 0, 0, 151), false)
dxDrawText(tekst,x2, y2, screenW * 0.1281, screenH * 0.5750, tocolor(255, 255, 255, 255), 1.00, foNte, "center", "top", false, true, false, false, false)



Postaw piwo autorowi tego posta
 

 
Więcej szczegółów
Wystawiono 1 piw(a):
borsuk
Wysłany: 2021-03-17, 08:41


xyzzz^

A nic






Wiek: 18
Na forum: 1993 dni
Posty: 319
Nick w MP: Aspyk21

Piwa: 308

Respekt: 81

Ostrzeżeń: 100%
"NoNamik" napisał/a:

xyzzz^, tyle to ja wiem

[ Dodano: 2021-03-15, 16:39 ]
xyzzz^, tylko mi chodzi o to by to sie animowalo jak w notyfikacja a jak patrze na kod notyfikacji to totalnie nie wiem co jest grane w nim

[ Dodano: 2021-03-15, 17:32 ]
zrobilem tak dziala animacja imaga ale tekst gdzies z gory przylatuje
Kod:

local x, y, z = interpolateBetween (screenW * 0.0000, screenH * 0.5213, 0, screenW * 1.2, screenH * 0.5226 , 0, (s-getTickCount())/(( s + 2000 ) - s ), "InOutBack")
local x2, y2, z2 = interpolateBetween (screenW * 0.0302, screenH * 0.5222, 0, screenW * 0.1281, screenH * 0.5750, 0, progress, "InOutBack")


dxDrawImage(x, y, screenW * 0.1323, screenH * 0.0546, ":pystories-admin/ogloszenie.png", 0, 0, 0, tocolor(255, 255, 255, 255), false)
dxDrawText(tekst,x2, y2, screenW * 0.1281, screenH * 0.5750, tocolor(255, 255, 255, 255), 1.00, foNte, "center", "top", false, true, false, false, false)
return end
local px, py, pz = getElementPosition(localPlayer)
local x, y, z = interpolateBetween (screenW * -0.2000, screenH * 0.5213, 0, screenW * 0.0022, screenH * 0.5226, 0, progress, "InOutBack")
local x2, y2, z2 = interpolateBetween (screenW * -0.0661, screenH * 0.5222, 0, screenW * 0.0000, screenH * 0.5750, 0, progress, "InOutBack")

dxDrawImage(x, y, screenW * 0.1323, screenH * 0.0546, ":pystories-admin/ogloszenie.png", 0, 0, 0, tocolor(255, 255, 255, 255), false)
--dxDrawRectangle(x, y, screenW * 0.2500 , screenH * 0.0365 + (width * 0.05), tocolor(0, 0, 0, 151), false)
dxDrawText(tekst,x2, y2, screenW * 0.1281, screenH * 0.5750, tocolor(255, 255, 255, 255), 1.00, foNte, "center", "top", false, true, false, false, false)


ustaw weight do tekstu ( na interpolace )

Postaw piwo autorowi tego posta
 

 
Więcej szczegółów
Wystawiono 1 piw(a):
borsuk
Wysłany: 2021-03-18, 20:15


NoNamik







Wiek: 35
Na forum: 2186 dni
Posty: 289
Nick w MP: JestemNoNamem

Piwa: 374

Respekt: 60

xyzzz^, przeciez jest

Postaw piwo autorowi tego posta
 

 
Więcej szczegółów
Wystawiono 1 piw(a):
borsuk
Wysłany: 2021-03-19, 08:39


xyzzz^

A nic






Wiek: 18
Na forum: 1993 dni
Posty: 319
Nick w MP: Aspyk21

Piwa: 308

Respekt: 81

Ostrzeżeń: 100%
"NoNamik" napisał/a:

xyzzz^, przeciez jest

a na x pr?bowa?e??

Postaw piwo autorowi tego posta
 

 
Więcej szczegółów
Wystawiono 1 piw(a):
borsuk
Wysłany: 2021-03-19, 10:28


NoNamik







Wiek: 35
Na forum: 2186 dni
Posty: 289
Nick w MP: JestemNoNamem

Piwa: 374

Respekt: 60

xyzzz^, w sns?

Postaw piwo autorowi tego posta
 

 
Więcej szczegółów
Wystawiono 1 piw(a):
borsuk
Tagi: animacja
Anonymous





Na forum: 245 dni
Posty: 1



Anonymous Koniecznie zajrzyj na:






Skocz do:  
Wyświetl posty z ostatnich:   
GTAONLINE.PL » JĘZYKI PROGRAMOWANIA » LUA » animacja Odpowiedz do tematu

Nie możesz pisać nowych tematów
Nie możesz odpowiadać w tematach
Nie możesz zmieniać swoich postów
Nie możesz usuwać swoich postów
Nie możesz głosować w ankietach
Dodaj temat do Ulubionych
Wersja do druku