File tree Expand file tree Collapse file tree 1 file changed +38
-1
lines changed
Expand file tree Collapse file tree 1 file changed +38
-1
lines changed Original file line number Diff line number Diff line change 3030
3131 < div class ="container d-flex flex-column align-items-center ">
3232 < div class ="row d-flex flex-column align-items-center ">
33+
3334 < h2 >
3435 < a href ="https://github.com/ru51a4/minimal_react "> rrender</ a >
35- - framework for building user interfaces
36+ - < span class =" ttext " > </ span >
3637 </ h2 >
3738 < br /> < span style ="text-align: center "> https://cdn.jsdelivr.net/gh/ru51a4/rrender/dist/rrender.js</ span >
3839 < br />
40+ < script >
41+ let textArray = [ "framework for building user interfaces." , "like vue but shit." , 'xml комбайн.' ] ;
42+ let textIndex = 0 ;
43+ let charIndex = 0 ;
44+ let isDeleting = false ;
45+ let element = document . querySelector ( ".ttext" ) ;
46+
47+ function typeWriter ( ) {
48+ // Условие для добавления и удаления текста
49+ if ( ! isDeleting && charIndex < textArray [ textIndex ] . length ) {
50+ // Добавление символов
51+ element . textContent += textArray [ textIndex ] . charAt ( charIndex ) ;
52+ charIndex ++ ;
53+ setTimeout ( typeWriter , 100 ) ; // Задержка между символами
54+ } else if ( isDeleting && charIndex > 0 ) {
55+ // Удаление символов
56+ element . textContent = textArray [ textIndex ] . substring ( 0 , charIndex - 1 ) ;
57+ charIndex -- ;
58+ setTimeout ( typeWriter , 100 ) ;
59+ } else {
60+ // Переключение между словами
61+ isDeleting = ! isDeleting ;
62+ if ( ! isDeleting ) {
63+ textIndex ++ ;
64+ if ( textIndex >= textArray . length ) {
65+ textIndex = 0 ;
66+ }
67+ }
68+ setTimeout ( typeWriter , 500 ) ; // Задержка между словами
69+ }
70+ }
71+
72+ // Запуск анимации
73+ typeWriter ( ) ;
74+
75+ </ script >
3976 </ div >
4077 < div class ="mt-5 row d-flex justify-content-center " style ="text-align: center ">
4178 < h2 > online demo:</ h2 >
You can’t perform that action at this time.
0 commit comments