71 lines
1.6 KiB
JavaScript
71 lines
1.6 KiB
JavaScript
const values = [
|
|
"Web developer",
|
|
"Pc games enjoyer",
|
|
"Server backend survivor",
|
|
"python programmer",
|
|
"Javascript disliker",
|
|
"I use Arch btw",
|
|
"Owo, what's this?",
|
|
"Ultimate procrastinator",
|
|
"Ultrakill gaming",
|
|
"00111010 00110011",
|
|
"fistful of dollar",
|
|
"Thy end is now!!!",
|
|
"Possibly a furry",
|
|
"Prepare thyself!!!",
|
|
"Spegatti code master",
|
|
"Ethernet cable untangler",
|
|
"Caffeine addict",
|
|
"I'm not a robot ☑",
|
|
"Loud Music enjoyer",
|
|
"part time femboy :<",
|
|
];
|
|
var direction = 1;
|
|
var text = "";
|
|
var speed = 100;
|
|
var selectedValue = 0;
|
|
var currentValueIndex = 0;
|
|
var pause = false;
|
|
|
|
function randomValue() {
|
|
selectedValue = Math.floor(Math.random() * values.length);
|
|
currentValueIndex = 0;
|
|
}
|
|
|
|
function type() {
|
|
if (direction == 1) {
|
|
if (currentValueIndex < values[selectedValue].length) {
|
|
text += values[selectedValue][currentValueIndex];
|
|
currentValueIndex++;
|
|
} else {
|
|
direction = -1;
|
|
pause = true;
|
|
}
|
|
} else {
|
|
if (currentValueIndex > 0) {
|
|
text = text.slice(0, -1);
|
|
currentValueIndex--;
|
|
} else {
|
|
direction = 1;
|
|
randomValue();
|
|
}
|
|
}
|
|
}
|
|
|
|
function typing() {
|
|
type();
|
|
document.getElementById("typing").innerHTML = "$ " + text;
|
|
if (direction == 1) {
|
|
speed = 80 + Math.random() * 100;
|
|
} else {
|
|
speed = 60 + (Math.random() * 100) / 2;
|
|
}
|
|
if (!pause) {
|
|
setTimeout(typing, speed);
|
|
} else {
|
|
setTimeout(typing, 500);
|
|
pause = false;
|
|
}
|
|
}
|
|
|
|
typing(); |