-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathindex.html
50 lines (48 loc) · 1.26 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
<!DOCTYPE html>
<html lang="zh-CN">
<head>
<meta charset="UTF-8">
<title>Triangle</title>
<script src="out/Triangles.js"></script>
<style>
body {
position: fixed;
top: 0;
right: 0;
bottom: 0;
left: 0;
margin: 0;
}
h1{
text-align: center;
color: #fff;
text-shadow: 0 0 1px rgba(0, 0, 0, 0.5);
}
</style>
</head>
<body class="bg-triangle">
<h1>Triangles Effect</h1>
<p></p>
</body>
<script>
const canvas = document.createElement("canvas");
canvas.style.position = "absolute";
canvas.style.top = "0";
canvas.style.left = "0";
canvas.width = document.body.clientWidth;
canvas.height = document.body.clientHeight;
canvas.style.zIndex = "-1";
document.body.style.backgroundColor = "transparent";
if (document.body.childElementCount > 0) {
document.body.insertBefore(canvas, document.body.childNodes[0]);
} else {
document.body.appendChild(canvas);
}
window.addEventListener("resize", () => {
canvas.width = document.body.clientWidth;
canvas.height = document.body.clientHeight;
});
new Triangles(canvas,"");
const triangles = new Triangles(canvas, "#e7659f", 150);
</script>
</html>