forked from QiShaoXuan/rhythm-ripple
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrhythm.html
More file actions
105 lines (91 loc) · 2.08 KB
/
rhythm.html
File metadata and controls
105 lines (91 loc) · 2.08 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
95
96
97
98
99
100
101
102
103
104
105
<!DOCTYPE html>
<html lang="zh-cmn-Hans">
<head>
<meta charset="UTF-8">
<meta name="viewport"
content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">
<link rel="icon"
href="https://qishaoxuan.github.io/animate_resume_ts/images/favicon.png">
<title>RhythmDisk Demo</title>
</head>
<style>
* {
margin: 0;
padding: 0;
list-style: none;
}
html, body {
height: 100%;
background: #303133;
}
.container{
height:100%;
display: flex;
justify-content: center;
align-items: center;
}
audio {
position: absolute;
left: 40px;
top: 40px;
z-index: 100;
}
.copyright {
position: absolute;
left: 15px;
bottom: 15px;
font-size: 14px;
color: #fff;
}
.link{
position: absolute;
right: 15px;
bottom: 15px;
font-size: 14px;
color: #fff;
}
@media screen and (max-width: 767px) {
audio {
left: 0;
right: 0;
margin: auto;
}
}
.body{
height:100%;
display: flex;
justify-content: center;
align-items: center;
position: relative;
}
</style>
<body>
<div class="body">
<div class="container">
<div id="canvas-container"></div>
</div>
<audio src="./asset/LiquorWhisper.mp3" controls
preload="auto" autoplay
cover='./asset/cover.jpg' id="audio"></audio>
<a href="https://github.com/QiShaoXuan/rhythm-disk" class="link">GITHUB ==></a>
<div class="copyright">Liquor Whisper - 王以太</div>
</div>
</body>
<script src="./dist/rhythmRipple.js"></script>
<script>
function detectDeviceType() {
return /Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent) ? 'Mobile' : 'Desktop'
}
const audio = document.querySelector('#audio')
document.body.addEventListener('click', function () {
audio.play()
}, {once: true})
const mobileOption = {
size: window.innerWidth - 30,
radius: .25,
rippeWidth: 2,
pointRadius: 4,
}
const rd = new RhythmRipple('#canvas-container', '#audio', detectDeviceType() === 'Mobile' ? mobileOption : {})
</script>
</html>