typer fix
This commit is contained in:
parent
e95e424a1e
commit
4a577e928a
@ -20,12 +20,12 @@ const values = [
|
|||||||
"Loud Music enjoyer",
|
"Loud Music enjoyer",
|
||||||
"part time femboy :<",
|
"part time femboy :<",
|
||||||
];
|
];
|
||||||
var direction = 1;
|
let typing_direction = 1;
|
||||||
var text = "";
|
let text = "";
|
||||||
var speed = 100;
|
let speed = 100;
|
||||||
var selectedValue = 0;
|
let selectedValue = 0;
|
||||||
var currentValueIndex = 0;
|
let currentValueIndex = 0;
|
||||||
var pause = false;
|
let pause = false;
|
||||||
|
|
||||||
function randomValue() {
|
function randomValue() {
|
||||||
selectedValue = Math.floor(Math.random() * values.length);
|
selectedValue = Math.floor(Math.random() * values.length);
|
||||||
@ -33,12 +33,12 @@ function randomValue() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function type() {
|
function type() {
|
||||||
if (direction == 1) {
|
if (typing_direction == 1) {
|
||||||
if (currentValueIndex < values[selectedValue].length) {
|
if (currentValueIndex < values[selectedValue].length) {
|
||||||
text += values[selectedValue][currentValueIndex];
|
text += values[selectedValue][currentValueIndex];
|
||||||
currentValueIndex++;
|
currentValueIndex++;
|
||||||
} else {
|
} else {
|
||||||
direction = -1;
|
typing_direction = -1;
|
||||||
pause = true;
|
pause = true;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
@ -46,7 +46,7 @@ function type() {
|
|||||||
text = text.slice(0, -1);
|
text = text.slice(0, -1);
|
||||||
currentValueIndex--;
|
currentValueIndex--;
|
||||||
} else {
|
} else {
|
||||||
direction = 1;
|
typing_direction = 1;
|
||||||
randomValue();
|
randomValue();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -55,7 +55,7 @@ function type() {
|
|||||||
function typing() {
|
function typing() {
|
||||||
type();
|
type();
|
||||||
document.getElementById("typing").innerHTML = "$ " + text;
|
document.getElementById("typing").innerHTML = "$ " + text;
|
||||||
if (direction == 1) {
|
if (typing_direction == 1) {
|
||||||
speed = 80 + Math.random() * 100;
|
speed = 80 + Math.random() * 100;
|
||||||
} else {
|
} else {
|
||||||
speed = 60 + (Math.random() * 100) / 2;
|
speed = 60 + (Math.random() * 100) / 2;
|
||||||
@ -72,7 +72,7 @@ typing();
|
|||||||
|
|
||||||
// HIDDEN STUFF (shh don't tell anyone >:3)
|
// HIDDEN STUFF (shh don't tell anyone >:3)
|
||||||
|
|
||||||
var last5Chars = "";
|
let last5Chars = "";
|
||||||
|
|
||||||
document.addEventListener('keydown', function(event) {
|
document.addEventListener('keydown', function(event) {
|
||||||
last5Chars += event.key;
|
last5Chars += event.key;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user