function dxDrawGifImage ( x, y, w, h, path, iEnd, effectSpeed )
local gifElement = createElement ( "dx-gif" )
if ( gifElement ) then
setElementData (
gifElement,
"gifData",
{
x = x,
y = y,
w = w,
h = h,
imgPath = path,
endID = iEnd,
imgID = 1,
speed = effectSpeed,
tick = getTickCount ( )
}
)
return gifElement
else
return false
end
end
addEventHandler ( "onClientRender", root,
function ( )
local currentTick = getTickCount ( )
for _, gif in ipairs ( getElementsByType ( "dx-gif" ) ) do
local gifData = getElementData ( gif, "gifData" )
if ( gifData ) then
if ( currentTick - gifData.tick >= gifData.speed ) then
gifData.tick = currentTick
gifData.imgID = ( gifData.imgID + 1 )
if gifData.imgID > gifData.endID then
gifData.imgID = 1
end
setElementData ( gif, "gifData", gifData )
end
dxDrawImage ( gifData.x, gifData.y, gifData.w, gifData.h, string.format(gifData.imgPath,gifData.imgID) )
end
end
end
)
gif = dxDrawGifImage ( 0.68, 0, 4.5, 3.55, "img/logo", 13, "png", 60 )