-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
93 lines (80 loc) · 2.6 KB
/
index.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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="apple-touch-icon" sizes="180x180" href="static/apple-touch-icon.png">
<link rel="icon" type="image/png" sizes="32x32" href="static/favicon-32x32.png">
<link rel="icon" type="image/png" sizes="16x16" href="static/favicon-16x16.png">
<link rel="manifest" href="static/site.webmanifest">
<title>Demo Audio Visualization</title>
</head>
<body>
<div class="vz-bg"></div>
<div class="vz-wrapper">
<audio id="myAudio" src="static/reverie.mp3" data-author="浮云心" data-title="Reverie(Remix)" preload="metadata"></audio>
<div class="vz-wrapper -canvas">
<canvas id="myCanvas" width="1200" height="800"></canvas>
<canvas id="myStaticCanvas" width="1200" height="800"></canvas>
</div>
</div>
<script src='https://cdn.jsdelivr.net/npm/[email protected]/lib/index.js'></script>
<script type="module" src='example.js'></script>
</body>
<style>
body {
margin: 0;
}
.vz-bg {
transform: scale(0.8, 0.8);
position: fixed;
background-image: url("static/background.png");
background-position: center;
height: 100vh;
width: 100%;
opacity: 0.9;
animation-name: backgroundShake;
animation-duration: 80s;
animation-iteration-count: infinite;
}
.vz-wrapper {
position: relative;
height: 100vh;
width: 100%;
box-shadow: inset 0 0 160px 0 #000;
}
#myCanvas {
z-index: 1;
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
height: initial;
width: initial;
background: transparent;
box-shadow: none;
}
#myStaticCanvas {
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
height: initial;
width: initial;
background: transparent;
box-shadow: none;
}
@media screen and (min-width: 420px) {
.vz-wrapper {
box-shadow: inset 0 0 200px 60px #000;
}
}
@keyframes backgroundShake {
20% {transform: translate(-20px, 20px) scale(1.2, 1.2);}
40% {transform: translate(20px, -20px) scale(1.2, 1.2);;}
60% {transform: translate(-10px, -20px) scale(1.2, 1.2);;}
80% {transform: translate(20px, -10px) scale(1.2, 1.2);;}
100% {transform: translate(0px, 0px) scale(0.8, 0.8);}
}
</style>
</html>