Answers for "create a typewriter effect in html"

3

javascript typewriter effect

// *** JS Typewriter Effect ***

	let i = 0;
    let target = document.getElementById("target");
    let text = target.innerHTML;
    target.innerHTML = ' ';
    let speed = 75; //speed duration of effect in millisec

    typeWriter(); //to call function
    function typeWriter() {
        if (i < text.length) {
            target.innerHTML += text.charAt(i);
            i++;
            setTimeout(typeWriter, speed);
        }
    }
Posted by: Guest on October-25-2020
0

typewriter effect

--luau 
local strings = "this is a string"

for i = 1, string.len(strings) do
	print(string.sub(strings,1,i))
	wait(0.2)
end
Posted by: Guest on June-11-2021

Browse Popular Code Answers by Language