The problem with running in the onReady() , is that since it’s an endless loop, no other screen action can occur, so the screen is never displayed.
If you really need to run it in the onReady() , and therefore can’t user Kristof’s code, try the following code that uses an interval timer. This allows the screen to render, while at the same time displaying another word every second.
let interval;
let timeInterval = 1000;
$w.onReady(function () {
let idx = 0;
const myWords = ["one", "two", "three", "four"];
interval = setInterval(function () {
$w("#vartext").text = myWords[idx++];
if (idx === myWords.length) idx = 0;
}, timeInterval);
});
If you want to stop the endless loop sometime, you can clear the interval somewhere, for example in a button click, or after 50 times, or whatever. Just do this:
Hi alydelpalacio,
Go to the discord channel from wix and check the round table challenge, i posted there a text animation package (for the challenge)
Is that what you are trying to do?
@volkaertskristof not sure, I haven’t been in the discord ever lol just new trying to apply changes to my site… I want a ‘slider of words’ really… so each word appears and disappears to give the space for the next one… as a list…
@volkaertskristof I don’t think is the same… I believe you’re refering to typewriting…? at least it’s what I saw in the round table… and what I want it’s a simple display & hide of consecutive words… I have 12 words, and I want them to appear and disapear one by one in the middle of a sentence… don’t know if I’m explaining it correctly… so really a ‘word slider’ I guess…
I’m not really sure what exactly you mean by it with the typewriter you show each word/sentence of an array,
When the first 1 is done, it disapears and the next starts showing.
Do you have an example on a page you sa somewhere?
I’m off to bed now.
Oke, so i tought about it a bit and i think i ubderstand now.
So you have a sentence with 12 words, something like"hi i am Kristof. Whats your name?"
You want to first show “hi” then “i’am” then “kristof” etc… but it has to stay on the same place in the sentence?