-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathindex.html
More file actions
94 lines (78 loc) · 1.72 KB
/
index.html
File metadata and controls
94 lines (78 loc) · 1.72 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="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Deepa RM</title>
<style>
@import url(https://fonts.googleapis.com/css?family=Anonymous+Pro);
body{
height: 100vh;
margin: 0;
display: flex;
justify-content: center;
align-items: center;
color: rgba(255,255,255,.75);
font-family: 'Anonymous Pro', monospace;
background-color: purple;
}
.type-container{
position: relative;
font-size: 1.8rem;
display: flex;
justify-content: center;
align-items: center;
}
#line{
position: relative;
}
.cursor{
height: 2rem;
width: 2px;
margin-left:2px;
background: rgba(255,255,255,.75);
animation: blinkTextCursor 800ms infinite;
}
@keyframes blinkTextCursor{
from{opacity: 1;}
to{opacity: 0;}
}
</style>
</head>
<body>
<div class="type-container">
<p id="line"></p>
<div class="cursor"></div>
</div>
<script>
var line = document.getElementById("line")
var txts = ['"Hi, I am Deepa RM"', '"I am a Web Developer"'];
var speed = 100
async function typewriter(txt) {
for(let i = 0; i < txt.length; i++){
line.innerHTML += txt.charAt(i);
await delay(speed)
}
}
async function reverseTypewriter(txt) {
for(let i = txt.length; i > 0; i--){
line.innerHTML = line.innerHTML.slice(0,-1)
await delay(speed)
}
}
async function writeLoop(){
for(let i = 0; i < txts.length; i++){
await typewriter(txts[i])
await delay(1000)
await reverseTypewriter(txts[i])
await delay(300)
}
writeLoop()
}
function delay(ms){
return new Promise((resolve)=>{setTimeout(()=>{resolve()},ms)})
}
writeLoop()
</script>
</body>
</html>