-
Notifications
You must be signed in to change notification settings - Fork 0
/
lirik.html
126 lines (112 loc) · 3.57 KB
/
lirik.html
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
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Lirik Lagu</title>
<style>
body {
background-color: #5b4b5b;
display: flex;
justify-content: center;
align-items: center;
height: 100vh;
margin: 0;
font-family: Arial, sans-serif;
}
.card {
background-color: #5b4b5b;
border-radius: 15px;
box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
width: 300px;
text-align: center;
padding: 20px;
color: white;
}
.song-info {
margin-top: 10px;
}
.song-info h2 {
margin: 10px 0 5px;
font-size: 18px;
}
.song-info p {
margin: 0;
font-size: 14px;
}
.lyrics {
margin: 20px 0;
font-size: 14px;
line-height: 1.5;
}
.highlight {
border: 2px solid cyan;
border-radius: 5px;
padding: 5px;
margin-bottom: 5px;
transform: scale(1.1);
transition: transform 0.3s ease;
}
button {
background-color: #333;
color: white;
border: none;
padding: 10px 20px;
border-radius: 5px;
cursor: pointer;
}
button:hover {
background-color: #555;
}
</style>
</head>
<body>
<div class="card">
<div class="song-info">
<h2>Cinta Kan Selalu Abadi</h2>
<p>lirik lagu</p>
</div>
<div class="lyrics">
<p id="line1"><b>Cinta kan selalu abadi</b></p>
<p id="line2"><b>walau takdir tak pasti</b></p>
<p id="line3"><b>kau selalu di hati</b></p>
<p id="line4"><b>cinta mati ku</b></p>
</div>
<div class="platform">
<button onclick="playSong()">Play</button>
</div>
</div>
<audio id="audioPlayer" src="cinta.mp3"></audio>
<script>
function playSong() {
var audio = document.getElementById("audioPlayer");
if (audio.paused) {
removeHighlight();
audio.play();
highlightLyrics();
} else {
audio.pause();
}
}
function removeHighlight() {
document.querySelectorAll('.highlight').forEach(el => el.classList.remove('highlight'));
}
function highlightLyrics() {
var audio = document.getElementById("audioPlayer");
audio.ontimeupdate = function() {
var currentTime = audio.currentTime;
removeHighlight();
if (currentTime >= 8 && currentTime < 10) {
document.getElementById('line1').classList.add('highlight');
} else if (currentTime >= 10 && currentTime < 14) {
document.getElementById('line2').classList.add('highlight');
} else if (currentTime >= 10 && currentTime < 17) {
document.getElementById('line3').classList.add('highlight');
} else if (currentTime >= 17) {
document.getElementById('line4').classList.add('highlight');
}
};
}
</script>
</body>
</html>