Jump to content

Problema con una animacion (SpriteAnim)


Bc#

Recommended Posts

Posted

Trato de hacer una animacion de un logo pero no logro que me funcione este es mi codigo.

  
function logoanimado() 
   SpriteAnim: new( "logo.png", 0.68, 0, 0.45,  0.355, 5, 5, 30); 
end 
  
addEventHandler( "onClientResourceStart", getResourceRootElement( getThisResource() ), logoanimado ) 

y esta es la imagen:

logowow.png

me estoy giando a partir de este post:

https://forum.multitheftauto.com/viewtopic.php?f=108&t=49179

Ayuda por favor.

Bc Media Clan XPG Foro
mtasa://104.223.20.159:21003

Posted

Si utilizo esa funcion, ¿Tendría que usar la misma imagen del post?

Si. Acuerdate que tiene que ser en secuencia las imagenes. Ejemplo radar_1,radar_2,radar_3.

------------------------------------------------------------------------------------------

My scripts

http://community.multitheftauto.com/index.php?p=resources&s=details&id=6977

http://community.multitheftauto.com/index.php?p=resources&s=details&id=7740

Posted

No entendi mucho lo de la susesion de imagenes

Pero ejemplo este es mi codigo.

  
gif = dxDrawGifImage ( 0.68, 0, 4.5,  3.55, "img/logo%", 0, "png", 60 ) 
  
addCommandHandler ( "destroygif", 
    function ( ) 
        destroyElement ( gif ) 
    end 
) 

asi me tendria que leer las imagenes que en su nombre tengan logo seguido de un numero.

Ejemplo.

logo1, logo2 , logo3, logo4.

Bc Media Clan XPG Foro
mtasa://104.223.20.159:21003

Posted
ese es el script de la wiki no es tuyo y esta mas lee mejor ;)

Si se que es de la wiki pero esta adecuado para mi proposito, lo que pregunto se es que funcionaria

Bc Media Clan XPG Foro
mtasa://104.223.20.159:21003

Posted

Este script estoy usando.

gif = dxDrawGifImage ( 0.68, 0, 4.5,  3.55, "img/logo%", 13, "png", 60 ) 
  
addCommandHandler ( "destroygif", 
    function ( ) 
        destroyElement ( gif ) 
    end 
) 

pero no se si estara bien el "img/logo%"

Bc Media Clan XPG Foro
mtasa://104.223.20.159:21003

Posted
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 ) 

San Andreas Utopia RPG (SAUR) Owner & Developer.

560x95_FFFFFF_FF9900_000000_000000.png

Education is the most powerful weapon which you can use to change the world.

Posted
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 ) 

Lo probe y no funciona

Bc Media Clan XPG Foro
mtasa://104.223.20.159:21003

Posted
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 
) 
  
local sWidth,sHeight = guiGetScreenSize() 
gif = dxDrawGifImage (sWidth*0,sHeight*0,sWidth*0.5,sHeight*0.5, "img/logo.png", 20, 120 ) 
  
addCommandHandler ( "destroygif", 
    function ( ) 
        destroyElement ( gif ) 
    end 
) 

rsilex.png.0e6ad382b3fdc3cbe6390e3e847572c9.png
Posted
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 
) 
  
local sWidth,sHeight = guiGetScreenSize() 
gif = dxDrawGifImage (sWidth*0,sHeight*0,sWidth*0.5,sHeight*0.5, "img/logo.png", 20, 120 ) 
  
addCommandHandler ( "destroygif", 
    function ( ) 
        destroyElement ( gif ) 
    end 
) 

Tampoco Funciona :C

Bc Media Clan XPG Foro
mtasa://104.223.20.159:21003

Posted

yo use esta funcion una vez ( me dio mucho lagg en mi server ), yo hice esto :

  
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 
) 
  
local sWidth,sHeight = guiGetScreenSize() 
gif = dxDrawGifImage (sWidth*0,sHeight*0,sWidth*0.5,sHeight*0.5, "img/logo1.png", 20, 120 ) 
gif = dxDrawGifImage (sWidth*0,sHeight*0,sWidth*0.5,sHeight*0.5, "img/logo2.png", 20, 120 ) 
gif = dxDrawGifImage (sWidth*0,sHeight*0,sWidth*0.5,sHeight*0.5, "img/logo3.png", 20, 120 ) 
gif = dxDrawGifImage (sWidth*0,sHeight*0,sWidth*0.5,sHeight*0.5, "img/logo4.png", 20, 120 ) 
gif = dxDrawGifImage (sWidth*0,sHeight*0,sWidth*0.5,sHeight*0.5, "img/logo5.png", 20, 120 ) 
gif = dxDrawGifImage (sWidth*0,sHeight*0,sWidth*0.5,sHeight*0.5, "img/logo6.png", 20, 120 ) 
gif = dxDrawGifImage (sWidth*0,sHeight*0,sWidth*0.5,sHeight*0.5, "img/logo7.png", 20, 120 ) 
gif = dxDrawGifImage (sWidth*0,sHeight*0,sWidth*0.5,sHeight*0.5, "img/logo8.png", 20, 120 ) 
gif = dxDrawGifImage (sWidth*0,sHeight*0,sWidth*0.5,sHeight*0.5, "img/logo9.png", 20, 120 ) 
gif = dxDrawGifImage (sWidth*0,sHeight*0,sWidth*0.5,sHeight*0.5, "img/logo10.png", 20, 120 ) 
gif = dxDrawGifImage (sWidth*0,sHeight*0,sWidth*0.5,sHeight*0.5, "img/logo11.png", 20, 120 ) 
gif = dxDrawGifImage (sWidth*0,sHeight*0,sWidth*0.5,sHeight*0.5, "img/logo12.png", 20, 120 ) 
gif = dxDrawGifImage (sWidth*0,sHeight*0,sWidth*0.5,sHeight*0.5, "img/logo13.png", 20, 120 ) 
  

elMota/elFoReX De Vuelta En MTA *---------*

Cuenta De Youtube En La Que Subo Tutoriales Acerca De MTA :3

https://www.youtube.com/user/KillersGPs

430x73_FFFFFF_FF9900_000000_000000.png
Posted

Porque eso que hiciste no tiene sentido, estas creando todas las imagenes como si la funcion no existiese.

@Bc: La posicion debe ser absolute.

San Andreas Utopia RPG (SAUR) Owner & Developer.

560x95_FFFFFF_FF9900_000000_000000.png

Education is the most powerful weapon which you can use to change the world.

Posted
yo use esta funcion una vez ( me dio mucho lagg en mi server ), yo hice esto :
  
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 
) 
  
local sWidth,sHeight = guiGetScreenSize() 
gif = dxDrawGifImage (sWidth*0,sHeight*0,sWidth*0.5,sHeight*0.5, "img/logo1.png", 20, 120 ) 
gif = dxDrawGifImage (sWidth*0,sHeight*0,sWidth*0.5,sHeight*0.5, "img/logo2.png", 20, 120 ) 
gif = dxDrawGifImage (sWidth*0,sHeight*0,sWidth*0.5,sHeight*0.5, "img/logo3.png", 20, 120 ) 
gif = dxDrawGifImage (sWidth*0,sHeight*0,sWidth*0.5,sHeight*0.5, "img/logo4.png", 20, 120 ) 
gif = dxDrawGifImage (sWidth*0,sHeight*0,sWidth*0.5,sHeight*0.5, "img/logo5.png", 20, 120 ) 
gif = dxDrawGifImage (sWidth*0,sHeight*0,sWidth*0.5,sHeight*0.5, "img/logo6.png", 20, 120 ) 
gif = dxDrawGifImage (sWidth*0,sHeight*0,sWidth*0.5,sHeight*0.5, "img/logo7.png", 20, 120 ) 
gif = dxDrawGifImage (sWidth*0,sHeight*0,sWidth*0.5,sHeight*0.5, "img/logo8.png", 20, 120 ) 
gif = dxDrawGifImage (sWidth*0,sHeight*0,sWidth*0.5,sHeight*0.5, "img/logo9.png", 20, 120 ) 
gif = dxDrawGifImage (sWidth*0,sHeight*0,sWidth*0.5,sHeight*0.5, "img/logo10.png", 20, 120 ) 
gif = dxDrawGifImage (sWidth*0,sHeight*0,sWidth*0.5,sHeight*0.5, "img/logo11.png", 20, 120 ) 
gif = dxDrawGifImage (sWidth*0,sHeight*0,sWidth*0.5,sHeight*0.5, "img/logo12.png", 20, 120 ) 
gif = dxDrawGifImage (sWidth*0,sHeight*0,sWidth*0.5,sHeight*0.5, "img/logo13.png", 20, 120 ) 
  

No anima la imagen creo que eso solo hace que salga una imagen ensima de la otra

Bc Media Clan XPG Foro
mtasa://104.223.20.159:21003

Posted
Porque eso que hiciste no tiene sentido, estas creando todas las imagenes como si la funcion no existiese.

@Bc: La posicion debe ser absolute.

¿Posision absolute?

Bueno yo lo de la posision es lo ultimo que queria ver pero pretendo que la imagen se plasme en la parte superior derecha de la pantalla, ¿Me podrías das un ejemplo?

Bc Media Clan XPG Foro
mtasa://104.223.20.159:21003

Posted

Simplemente consegui la posicion en absolute.

San Andreas Utopia RPG (SAUR) Owner & Developer.

560x95_FFFFFF_FF9900_000000_000000.png

Education is the most powerful weapon which you can use to change the world.

Posted

Cuando usas DirectX, tenes que usar posiciones en "absolute".

Una posicion absolute seria asi: 500, 500, 100, 200

Una en relative seria algo asi: 0.05, 0.8, 0.65, 0.15

San Andreas Utopia RPG (SAUR) Owner & Developer.

560x95_FFFFFF_FF9900_000000_000000.png

Education is the most powerful weapon which you can use to change the world.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...