Wysłany: 2021-03-15, 14:39
NoNamik
Wiek: 35 Na forum: 2186 dni Posty: 289
Nick w MP: JestemNoNamem
Piwa : 374
Witam chcialem zrobic animowane ogloszenia zeby sie wysuwaly i wsuwaly lecz jestem zielony w temacie animacji w mta
local start = getTickCount ()
function isEventHandlerAdded ( sEventName , pElementAttachedTo , func )
if
type ( sEventName ) == 'string' and
isElement ( pElementAttachedTo ) and
type ( func ) == 'function'
then
local aAttachedFunctions = getEventHandlers ( sEventName , pElementAttachedTo )
if type ( aAttachedFunctions ) == 'table' and #aAttachedFunctions > 0 then
for i , v in ipairs ( aAttachedFunctions ) do
if v == 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 , y = 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.0005 , screenH * 0.5213 , screenW * 0.1323 , screenH * 0.0546 , ":pystories-admin/ogloszenie.png" , 0 , 0 , 0 , tocolor ( 255 , 255 , 255 , 255 ), false )
dxDrawText ( tekst , screenW * 0.0286 , screenH * 0.5213 , screenW * 0.1255 , screenH * 0.5759 , tocolor ( 255 , 255 , 255 , 255 ), 1.00 , "default-bold" , "center" , "center" , false , true , false , true , false )
-- dxDrawText ( tekst , xt , yt , screenW * 0.6382 , screenH * 0.8555 , tocolor ( 255 , 255 , 255 , 255 ), 1.00 , foNte , "center" , "top" , false , true , false , true , false )
end
end
end
function roundedRectangle ( x , y , w , h , borderColor , bgColor , postGUI )
if ( x and y and w and h ) then
if ( not borderColor ) then
borderColor = tocolor ( 0 , 0 , 0 , 200 );
end
if ( not bgColor ) then
bgColor = borderColor ;
end
--> Background
-- dxDrawRectangle ( x , y , w , h , bgColor , postGUI );
--> Border
-- dxDrawRectangle ( x + 2 , y - 1 , w - 4 , 1 , borderColor , postGUI ); -- top
-- dxDrawRectangle ( x + 2 , y + h , w - 4 , 1 , borderColor , postGUI ); -- bottom
-- dxDrawRectangle ( x - 1 , y + 2 , 1 , h - 4 , borderColor , postGUI ); -- left
-- dxDrawRectangle ( x + w , y + 2 , 1 , h - 4 , borderColor , postGUI ); -- 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 , hud ) then
removeEventHandler ( "onClientRender" , root , hud )
end
l ={ math . random ( 0 , 255 ), math . random ( 0 , 255 ), math . random ( 0 , 255 )}
czas = getTickCount ()
start = getTickCount ()
s = nil
addEventHandler ( "onClientRender" , root , hud )
else
removeEventHandler ( "onClientRender" , root , hud )
czas = getTickCount ()
start = getTickCount ()
s = nil
l ={}
end
end
end )
addEventHandler ( "onClientRender" , root , hud )
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
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
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)
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
"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 )
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
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
"NoNamik" napisał/a :
a na x pr?bowa?e??
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
Więcej szczegółów
Wystawiono 1 piw(a):borsuk
Tagi: animacja
Anonymous
Na forum: 245 dni
Posty: 1
Anonymous Koniecznie zajrzyj na: