-
Notifications
You must be signed in to change notification settings - Fork 2
/
index.html
98 lines (86 loc) · 2.21 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
94
95
96
97
98
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Gen art Starter</title>
<script src="node_modules/p5/lib/p5.js"></script>
<script src="node_modules/p5.js-svg/dist/p5.svg.js"></script>
<script>
const params = new URLSearchParams(window.location.search)
function genTokenData(projectNum) {
let data = {};
let hash = "0x";
for (var i = 0; i < 64; i++) {
hash += Math.floor(Math.random() * 16).toString(16);
}
if (params.get('randomSeedValue')) {
data.hash = params.get('randomSeedValue')
}
else {
data.hash = hash;
}
data.tokenId = (projectNum * 1000000 + Math.floor(Math.random() * 1000)).toString();
return data;
}
let tokenData = genTokenData(000);
</script>
<style>
html,
body {
margin: 0;
padding: 0;
height: 100%;
background: rgb(245, 245, 245);
font-family: 'Avenir';
}
main {
display: flex;
justify-content: center;
align-items: center;
position: relative;
}
.btn {
all: unset;
cursor: pointer;
border: 1px solid black;
padding: .125rem 1rem;
}
input {
padding: .125rem;
}
.ctrl {
display: flex;
align-items: center;
padding: .125rem;
margin-bottom: 1rem;
}
.ctrl__group {
margin: 0 .25rem;
}
</style>
</head>
<body>
<div class="ctrl">
<div class="ctrl__group">
<form action="/" method="GET">
<input name="randomSeedValue" id="randomSeedValue1" value="" />
<button class="btn" type="submit">Set Seed</button>
</form>
</div>
<div class="ctrl__group">
<form action="/" method="GET">
<input name="randomSeedValue" id="randomSeedValue" value="" type="hidden" />
<button class="btn" type="submit">Use Current</button>
</form>
</div>
<div class="ctrl__group">
<a href="/" class="btn">Clear Seed</a>
</div>
</div>
<script>
document.getElementById('randomSeedValue').value = tokenData.hash;
</script>
<script type="module" src="src/sketch.js"></script>
</body>
</html>