let i = 0;
let interval = 100;
let pause = 5000;
const text = "My text is here. Yes, it's here.";
let runTyping = ms => setTimeout(() => showText(), ms);
console.log(runTyping());
function showText() {
//let text = "xxx";
//text = text.slice(0, i);
$w("#text1").text = text.slice(0, i);
i = (i + 1) % (text.length + 1);
i > 0 ? runTyping(interval) : runTyping(pause);
}
$w.onReady(() =>{runTyping(interval)});
So, thestrokesstudio , please explain what exactly you wish to do.
Do you want to show each sentence at once and loop between them?
Or maybe you want to have a typewriting effect for the combination of 3 sentences?
Let’s say I have three words: “Free Goods”, “Best Service” & “Discounted Price”.
I want these three words to come one after another while disappearing the previous word. Also, in a typewriter effect.
let i =0, interval =100, pause =5000;
const text ="My text is here. Yes, it's here.";
construnTyping=(ms)=>setTimeout(()=>showText(), ms);
functionshowText(){$w("#text1").text = text.slice(0, i); i =(i +1)%(text.length +1);
i >0? runTyping(interval):runTyping(pause);
}
$w.onReady(()=>runTyping(interval));