Why not printing word by word ??? (TextAnimation) [Solved] | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 2

Why not printing word by word ??? (TextAnimation) [Solved]

https://code.sololearn.com/WSQE451iGWKJ/?ref=app

2nd Apr 2021, 5:34 AM
Abhishek Singh
Abhishek Singh - avatar
27 Answers
+ 5
There's some nice code linked here by people. Thanks Sofi (DM Closed❌) and others. I wrote an ES6 style solution which uses setInterval() to get the typing effect and clearInterval() for cleaning up, without needing any recursion. https://code.sololearn.com/WebK43H2QT7l/?ref=app
2nd Apr 2021, 10:54 AM
CamelBeatsSnake
CamelBeatsSnake - avatar
+ 3
Abhishek Singh because setInterval works till until there is no clear interval after certain time period.
2nd Apr 2021, 5:36 AM
A͢J
A͢J - avatar
2nd Apr 2021, 6:33 AM
Սոֆի Մովսեսյան
Սոֆի Մովսեսյան - avatar
+ 3
var i = 0, text;//i = 0, for starting with first letter text = "Hello️" //writing text function typing() { if (i < text.length) { // if i less than text letters do something var a = document.getElementById("text")//getting text on htmk for writing in it a.innerHTML += text.charAt(i); // in htmk write text i-rd letter CharAt return only one letter i++;//i += i setTimeout(typing, 70); //for animation } } onload=typing;
2nd Apr 2021, 6:53 AM
Սոֆի Մովսեսյան
Սոֆի Մովսեսյան - avatar
+ 2
Abhishek Singh That's not a right way to convert in array. You can use split function to convert string in array https://code.sololearn.com/W398ljZC8DTN/?ref=app Stop setInterval like this https://code.sololearn.com/Ws124zm38Cm9/?ref=app
2nd Apr 2021, 5:49 AM
A͢J
A͢J - avatar
+ 2
Abhishek Singh you want typing animation?
2nd Apr 2021, 6:06 AM
Սոֆի Մովսեսյան
Սոֆի Մովսեսյան - avatar
+ 2
You can use css for it also😁
2nd Apr 2021, 6:23 AM
Սոֆի Մովսեսյան
Սոֆի Մովսեսյան - avatar
+ 2
Sofi (DM Closed❌) thank you very much But can anyone explain me this code 🤔😔😕😪 I don't want to just copy it
2nd Apr 2021, 6:46 AM
Abhishek Singh
Abhishek Singh - avatar
+ 2
Sofi (DM Closed❌) thank you very much
2nd Apr 2021, 7:32 AM
Abhishek Singh
Abhishek Singh - avatar
+ 2
Abhishek Singh do you really understand?
2nd Apr 2021, 7:52 AM
Սոֆի Մովսեսյան
Սոֆի Մովսեսյան - avatar
2nd Apr 2021, 8:28 AM
Krish
Krish - avatar
+ 2
Krish [less active] thank you very much
2nd Apr 2021, 1:03 PM
Abhishek Singh
Abhishek Singh - avatar
+ 2
Sofi (DM Closed❌) yes I understood it sis
2nd Apr 2021, 1:04 PM
Abhishek Singh
Abhishek Singh - avatar
+ 1
Abhishek Singh What you want to do ?
2nd Apr 2021, 5:38 AM
A͢J
A͢J - avatar
+ 1
Abhishek Singh Word by word will not print because it's a string. If you want to print word by word then convert in array.
2nd Apr 2021, 5:39 AM
A͢J
A͢J - avatar
+ 1
🅰🅹 thank you I mean to print it like this https://code.sololearn.com/WkGxaoTWrBHe/?ref=app by other means 😇😇
2nd Apr 2021, 5:50 AM
Abhishek Singh
Abhishek Singh - avatar
+ 1
Sofi (DM Closed❌) yes you are right
2nd Apr 2021, 6:12 AM
Abhishek Singh
Abhishek Singh - avatar
+ 1
Sofi (DM Closed❌) trying something new 😅😆😅
2nd Apr 2021, 6:33 AM
Abhishek Singh
Abhishek Singh - avatar
+ 1
CamelBeatsSnake thanks for helping me
2nd Apr 2021, 1:04 PM
Abhishek Singh
Abhishek Singh - avatar
+ 1
I know you already got solution But try with extra delay & line break features in short code https://code.sololearn.com/W1pzn70v4SGc/?ref=app
3rd Apr 2021, 4:56 AM
SAN
SAN - avatar