-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
58 lines (39 loc) · 973 Bytes
/
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
<!DOCTYPE html>
<html>
<head>
<style>
body {
display: flex;
margin: 0;
padding: 0;
width: 100vw;
height: 100vh;
}
</style>
</head>
<body>
<canvas id="canvas"/>
<script src="cubic_bezier.js"></script>
<script src="wave_container.js"></script>
<script src="wave.js"></script>
<script>
'use strict';
function setupCanvas() {
boundaries = parent.getBoundingClientRect();
canvas.width = boundaries.width;
canvas.height = boundaries.height;
}
function onClick(e) {
wave_container.push(e.clientX, e.clientY);
}
document.addEventListener('click', onClick);
window.addEventListener('resize', setupCanvas);
const canvas = document.body.querySelector('canvas');
const ctx = canvas.getContext('2d');
const parent = canvas.parentElement;
const wave_container = new WaveContainer();
var boundaries;
setupCanvas();
</script>
</body>
</html>