Leonardo Sotelo

Generation

generate functionMon, 26 Jun 2023

funtion that generate a typing text using this syntax function typeText(words, bgcolor, textcolor, speed) { let note = document.createElement('div') document.body.appendChild(note) }

function typeText(words, bgcolor, textcolor, speed) { let note = document.createElement('div') document.body.appendChild(note) note.style.background = bgcolor note.style.color = textcolor note.style.fontSize = '1.2rem' note.style.margin = '1rem 0' note.style.padding = '.5rem' const letter = words.split('') letter.forEach((letter, i) => { setTimeout(() => note.textContent += letter, 70 * i) }) if (speed) { setTimeout(() => note.remove(), 70 * letter.length + speed) } else { setTimeout(() => note.remove(), 70 * letter.length + 350) } } typeText('This is a message.', 'lightblue', 'white', 600)

Javascript
Generate More

Want to kickstart your project?Use the new AI Studio to create your code