-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
51 lines (50 loc) · 1.92 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
<!DOCTYPE html>
<html>
<head>
<title>Kinetics by Andrew Mitchell</title>
<meta charset="utf-8">
<script id="fxhash-snippet">
//---- do not edit the following code (you can indent as you wish)
let search = new URLSearchParams(window.location.search)
let alphabet = "123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ"
var fxhash = search.get('fxhash') || "oo" + Array(49).fill(0).map(_=>alphabet[(Math.random()*alphabet.length)|0]).join('')
// fxhash = "ooChzEFZmZeDNZdZxQTuVRwskdJPgYiFVoKPHewbgd43DxkFxST";
// fxhash = "ooza2GDQUMPXK2XEaFndiZsmAFwKmqz3oNgM7rELBMcB1TbJp6X";
let b58dec = str=>[...str].reduce((p,c)=>p*alphabet.length+alphabet.indexOf(c)|0, 0)
let fxhashTrunc = fxhash.slice(2)
let regex = new RegExp(".{" + ((fxhash.length/4)|0) + "}", 'g')
let hashes = fxhashTrunc.match(regex).map(h => b58dec(h))
let sfc32 = (a, b, c, d) => {
return () => {
a |= 0; b |= 0; c |= 0; d |= 0
var t = (a + b | 0) + d | 0
d = d + 1 | 0
a = b ^ b >>> 9
b = c + (c << 3) | 0
c = c << 21 | c >>> 11
c = c + t | 0
return (t >>> 0) / 4294967296
}
}
var fxrand = sfc32(...hashes)
// true if preview mode active, false otherwise
// you can append preview=1 to the URL to simulate preview active
var isFxpreview = search.get('preview') === "1"
// call this method to trigger the preview
function fxpreview() {
window.dispatchEvent(new Event("fxhash-preview"));
setTimeout(() => fxpreview(), 500);
}
//---- /do not edit the following code
</script>
<link rel="stylesheet" href="./style.css">
<script src="jquery.min.js"></script>
<script src="p5.min.js"></script>
<!-- if you need to import js scripts do it here -->
</head>
<body>
<script src="kinetics.min.js"></script>
<main>
</main>
</body>
</html>