Jump to content

[AYUDA] Como hacer que un texto aparezca letra por letra.


Pipee20k

Recommended Posts

Posted

Quiero hacer que aparezca un texto y se vaya escribiendo letra por letra hasta completarse. Algo como.

T

Te

Tes

Test

Obviamente todo en la misma línea pero la idea es que el texto vaya apareciendo carácter por carácter; no sé si se entienda bien esto u.u

Posted

Hice esta funcion para alguien que tambien me pregunto lo mismo hace tiempo, no se si aun funcionara.

local texts = { } 
  
function dxDrawTextPerLetter ( text, left, top, right, bottom, color, scale, font, alignX, alignY, clip, wordBreak, postGUI, colorCoded, subPixelPositioning, delay ) 
    if ( not texts [ text ] ) then 
        texts [ text ] = 
            { 
                index = 1, 
                lastUpdate = getTickCount ( ) 
            } 
    end 
    if ( texts [ text ] ) then 
        dxDrawText ( text:sub ( 1, texts [ text ].index ), left, top, right, bottom, color or tocolor ( 255, 255, 255, 255 ), scale or 1, font or "default", alignX or "left", alignY or "top", clip, wordBreak, postGUI, colorCoded, subPixelPositioning ) 
        if ( getTickCount ( ) - texts [ text ].lastUpdate >= ( delay or 60 ) ) then 
            texts [ text ].index = ( texts [ text ].index + 1 ) 
            texts [ text ].lastUpdate = getTickCount ( ) 
        end 
    end 
end 

Y para probarla:

local sx, sy = guiGetScreenSize ( ) 
  
addEventHandler ( "onClientRender", root, 
    function ( ) 
        dxDrawTextPerLetter ( "Testing the function", 0, 0, sx, sy / 2, false, false, false, false, false, false, false, false, false, false, 50 ) 
    end 
) 

Posted

¿No seria mas cómodo poner el delay de primer argumento? Quizá confundiría un poco pero te evitas tener que poner muchos argumentos innecesarios.

Posted

No es una funcion publica, la hice para alguien hace tiempo y asi quedo, si la queres con el delay de primer argumento, entonces lo cambias.

  • Recently Browsing   0 members

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