-
Notifications
You must be signed in to change notification settings - Fork 0
/
st_animation.py
68 lines (60 loc) · 1.25 KB
/
st_animation.py
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
typing_animation_html = '''
<div class="typewriter">
<h1>Data Tales Unfolded!📊</h1>
</div>
'''
typing_animation_css = '''
<style>
.typewriter {
display: flex;
justify-content: center;
align-items: center;
height: 50%; /* Update to percentage value */
}
.typewriter h1 {
overflow: hidden;
border-right: .15em solid orange;
white-space: nowrap;
margin-top: 1%; /* Update to percentage value */
margin-bottom: 5%;
letter-spacing: .15em;
animation:
typing 3.5s steps(40, end),
blink-caret .75s step-end infinite;
}
@keyframes typing {
from {
width: 0
}
to {
width: 100%
}
}
@keyframes blink-caret {
from,
to {
border-color: transparent
}
50% {
border-color: orange
}
}
</style>
'''
typing_animation_js = '''
<script>
document.addEventListener('DOMContentLoaded', function(event) {
var i = 0;
var txt = 'Data Tales Unfolded!📊';
var speed = 100; /* The speed/duration of the typing effect in milliseconds */
function typeWriter() {
if (i < txt.length) {
document.querySelector('.typewriter h1').textContent += txt.charAt(i);
i++;
setTimeout(typeWriter, speed);
}
}
typeWriter();
});
</script>
'''