I recently found this closed thread which I am really thankful because it works great for the typewriter effect.
(https://www.wix.com/velo/forum/coding-with-velo/typewriter-effect)
I wanted to reference it here to make is easier to understand what I am trying to accomplish even though it is a closed thread.
Basically I want to try and have 3 stances of the typewriter effect happening on the same page.
Can someone help? I apologize for my lack of code knowledge
function showText () {
const text = words [ index ];
$w ( ‘#text1’ ). text = text . slice ( 0 , i );
i = ( i + 1 ) % ( text . length + 1 );
if ( i > 0 ) {
runTyping ( letterInterval );
} else {
index ++;
index %= ( words . length );
runTyping ( pauseBetweenWords );
}
}
function showText2 () {
const text2 = words2 [ index ];
$w ( '#text2
’ ). text2 = text2 . slice ( 0 , i );
i = ( i + 1 ) % ( text2 . length + 1 );
if ( i > 0 ) {
runTyping ( letterInterval );
} else {
index ++;
index %= ( words . length );
runTyping ( pauseBetweenWords );
}
}
Word by word and infinite loop!
world pool1 = “A, B, C”
world pool2 = “D, E, F”
world pool3 = “G, H, J”
display
line1: any word from world pool1
line2 : any word from world pool2
line3 : any word from world pool3
they all can start typing at same time all lines at once
or top line to bottom line after each
with a longer pause so user can ready 3 words phrase.
I got it working with all code with the help of a friend but it’s not super clear and not completely random order. I shuffled the phrases manually.
ideally the pool would look something like this:
Ah, sorry, I didn’t read your request carefully.
Do you want it to shuffle how exactly?
Please elaborate what should be the output.
Shuffling the words inside each sentence?
like:
sentence 1 : w1, w2, w3 OR w2, w1, w3 etc?
The text block will show something like this:
1 word per line
line1, =(anyword from W1, W2, W3)
line2, =(anyword from W4, W5, W6)
line3 =(anyword from W7, W8, W9)
just one word per line selected randomly
In a loop
Everything can be done, but you have to describe it precisely.
Do you want each word to appear letter by letter? the whole word together (which is what you currently have)? word-pause-word? something else?