writre information like command line way
Created
February 2, 2023 03:39
-
-
Save al-swaiti/23602fa47e8875b86f175da17f4d8efb to your computer and use it in GitHub Desktop.
terminal , CMD
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<div class="container"> | |
<p>/><span class="typed-text"></span><span class="cursor"> </span></p> | |
</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const typedTextSpan = document.querySelector(".typed-text"); | |
const cursorSpan = document.querySelector(".cursor"); | |
const textArray = [ | |
"Hi ...", | |
"My", | |
"Name", | |
"Abdallah Alswaiti", | |
"You Are", | |
"WELCOM!" | |
]; | |
const typingDelay = 200; | |
const erasingDelay = 100; | |
const newTextDelay = 2000; // Delay between current and next text | |
let textArrayIndex = 0; | |
let charIndex = 0; | |
function type() { | |
if (charIndex < textArray[textArrayIndex].length) { | |
if (!cursorSpan.classList.contains("typing")) | |
cursorSpan.classList.add("typing"); | |
typedTextSpan.textContent += textArray[textArrayIndex].charAt(charIndex); | |
charIndex++; | |
setTimeout(type, typingDelay); | |
} else { | |
cursorSpan.classList.remove("typing"); | |
setTimeout(erase, newTextDelay); | |
} | |
} | |
function erase() { | |
if (charIndex > 0) { | |
if (!cursorSpan.classList.contains("typing")) | |
cursorSpan.classList.add("typing"); | |
typedTextSpan.textContent = textArray[textArrayIndex].substring( | |
0, | |
charIndex - 1 | |
); | |
charIndex--; | |
setTimeout(erase, erasingDelay); | |
} else { | |
cursorSpan.classList.remove("typing"); | |
textArrayIndex++; | |
if (textArrayIndex >= textArray.length) textArrayIndex = 0; | |
setTimeout(type, typingDelay + 1100); | |
} | |
} | |
document.addEventListener("DOMContentLoaded", function () { | |
// On DOM Load initiate the effect | |
if (textArray.length) setTimeout(type, newTextDelay + 250); | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@import url("https://fonts.googleapis.com/css?family=Montserrat:200"); | |
* { | |
margin: 0; | |
padding: 0; | |
box-sizing: border-box; | |
} | |
body { | |
font-family: "Montserrat", sans-serif; | |
background-color: #000; | |
color: #693055; | |
} | |
.container { | |
height: 100vh; | |
display: flex; | |
justify-content: left; | |
align-items: center; | |
} | |
.container p { | |
font-size: 3rem; | |
padding: 0.5rem; | |
font-weight: bold; | |
letter-spacing: 0.1rem; | |
text-align: center; | |
overflow: hidden; | |
} | |
.container p span.typed-text { | |
font-weight: normal; | |
color: hsl(158, 57%, 33%, 1); | |
} | |
.container p span.cursor { | |
display: inline-block; | |
background-color: #ccc; | |
margin-left: 0.1rem; | |
width: 3px; | |
animation: blink 1s infinite; | |
} | |
.container p span.cursor.typing { | |
animation: none; | |
} | |
@keyframes blink { | |
0% { | |
background-color: #693055; | |
} | |
49% { | |
background-color: #693055; | |
} | |
50% { | |
background-color: transparent; | |
} | |
99% { | |
background-color: transparent; | |
} | |
100% { | |
background-color: #ccc; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment