-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathanimation.html
More file actions
94 lines (81 loc) · 2.43 KB
/
animation.html
File metadata and controls
94 lines (81 loc) · 2.43 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
<!DOCTYPE html>
<html lang="de">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>FloriDevs Animation</title>
<!-- Google Font für die Schreibschrift Pacifico -->
<link href="https://fonts.googleapis.com/css2?family=Pacifico&display=swap" rel="stylesheet">
<style>
/* Setze den Hintergrund auf schwarz */
body {
background-color: #1a1a2e; /* Dunkles Blau als Fallback-Hintergrundfarbe */
background-image: url('https://floridevs.github.io/codepages89898/codes/index.png'); /* Dein Hintergrundbild */
background-size: cover;
background-position: center;
background-repeat: no-repeat;
background-attachment: fixed;
margin: 0;
padding: 0;
display: flex;
justify-content: center;
align-items: center;
height: 100vh;
background-color: black;
font-family: 'Pacifico', cursive;
}
.container {
text-align: center;
}
#text {
color: white;
font-size: 50px;
white-space: nowrap;
overflow: hidden;
display: inline-block;
}
</style>
</head>
<body>
<div class="container">
<span id="text"></span>
</div>
<script>
const textElement = document.getElementById("text");
const text = "FloriDevs";
let currentIndex = 0;
let isReversed = false;
let typingSpeed = 100; // Geschwindigkeit der Schriftanimation
// Funktion zum Tippen
function typeWriter() {
if (!isReversed) {
if (currentIndex < text.length) {
textElement.textContent += text[currentIndex];
currentIndex++;
setTimeout(typeWriter, typingSpeed);
} else {
// Wenn der Text vollständig getippt ist, starte rückwärts
setTimeout(reverseWriter, 500); // Kurze Pause, bevor Rückwärts-Animation beginnt
}
} else {
if (currentIndex > 0) {
textElement.textContent = textElement.textContent.slice(0, -1);
currentIndex--;
setTimeout(reverseWriter, typingSpeed);
} else {
// Wenn rückwärts gelöscht, starten wir wieder von vorne
isReversed = false;
setTimeout(typeWriter, 500);
}
}
}
// Funktion für rückwärts löschen
function reverseWriter() {
isReversed = true;
typeWriter();
}
// Initialisiere das Schreiben
typeWriter();
</script>
</body>
</html>