-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmc-twist.html
More file actions
176 lines (159 loc) · 5.77 KB
/
mc-twist.html
File metadata and controls
176 lines (159 loc) · 5.77 KB
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
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8" />
<title>PNG -> Minecraft Drop</title>
<meta name="viewport" content="width=device-width, initial-scale=1" />
<link rel="stylesheet" href="/assets/mc-styles.css" />
<!--
Confused on this following script? It's a UTM tracker.
It tracks what referred you here and sends it to my API.
For example, if you came from my steam profile, it'd have:
?utm_source=steamcommunity.com
Which sends back that you came from my steam(or other steam profile).
Then you will also see something appended to it like:
&utm_campaign=steamprofile_abtme
Which further identifies where you came from.
So a full utm url might look like:
https://lachlanm05.com/?utm_source=steamcommunity&utm_campaign=steamprofile_abtme
And the whole purpose of such is to find out where people are coming from.
As I can see where in the world people are coming from based on IP's, but not anything else.
-->
<script>
(function () {
// run asap, but safe
function getCookie(n) {
return document.cookie.split('; ').reduce((r, v) => {
const p = v.split('=');
return p[0] === n ? decodeURIComponent(p[1]) : r
}, null);
}
function setCookie(n, v, days) {
const d = new Date();
d.setTime(d.getTime() + (days * 24 * 60 * 60 * 1000));
document.cookie = n + "=" + encodeURIComponent(v)
+ ";expires=" + d.toUTCString() + ";path=/;SameSite=Lax";
}
// check UTM params immediat
var url = new URL(window.location.href);
var params = url.searchParams;
var keys = ["utm_source", "utm_medium", "utm_campaign", "utm_term", "utm_content"];
var hasUTM = false;
var payload = {};
keys.forEach(k => {
if (params.has(k)) {
hasUTM = true;
payload[k] = params.get(k);
}
});
if (!hasUTM) return;
// prevent duping on auto refresh / SPA nav
if (getCookie("lm_reftrack_sent") === "1") return;
payload.full_url = window.location.href;
payload.landing_path = window.location.pathname + window.location.search;
// send immediatialy using keepalive so it works even if user quick leaves
try {
fetch("https://lachlanm05.com/api/reftrack", {
method: "POST",
headers: { "Content-Type": "application/json" },
keepalive: true,
body: JSON.stringify(payload)
}).finally(function () {
setCookie("lm_reftrack_sent", "1", 1);
});
} catch (e) {
setCookie("lm_reftrack_sent", "1", 1);
}
})();
</script>
</head>
<body>
<header>
<h1>Minecraft Drops</h1>
<p>a tool i made to make funny spinning items instead of booting up minecraft each time.</p>
</header>
<main>
<section class="panel">
<div class="uploader">
<input id="fileInput" type="file" accept="image/png" />
<div class="or">or</div>
<div id="dropZone">drag & PNG here</div>
</div>
<div class="controls">
<div class="row">
<label>Duration (s)
<input id="duration" type="number" min="0.5" step="0.1" value="4.6" />
</label>
<label>Frames (for custom FPS)
<input id="frames" type="number" min="8" step="1" value="64" />
</label>
<label>Scale
<input id="scale" type="number" min="0.1" step="0.1" value="1.0" />
</label>
<label>Bob amplitude
<input id="amplitude" type="number" min="0" step="0.01" value="0.12" />
</label>
</div>
<div class="row">
<label>Spin turns / loop
<input id="turns" type="number" min="0.1" step="0.1" value="1" />
</label>
<label>Bob cycles / loop
<input id="bobCycles" type="number" min="0" step="0.1" value="1" />
</label>
<label>Canvas size (px)
<input id="size" type="number" min="64" step="64" value="512" />
</label>
<label>
<input id="shadow" type="checkbox" checked /> Soft shadow
</label>
</div>
<div class="row">
<label>FPS Mode
<select id="fpsMode">
<option value="match">Match Preview (monitor/RAF)</option>
<option value="custom">Custom FPS</option>
</select>
</label>
<label>Custom FPS
<input id="customFps" type="number" min="1" max="240" step="1" value="60" />
</label>
<label>WebM Codec
<select id="codecPref">
<option value="vp9">VP9 (alpha-capable)</option>
<option value="vp8">VP8</option>
<option value="auto">Auto</option>
</select>
</label>
</div>
<div class="buttons">
<button id="previewBtn" disabled>Preview</button>
<button id="renderWebmBtn" class="primary" disabled>Render WebM (Best Option)</button>
<button id="renderApngBtn">Render APNG</button>
</div>
<div id="whyBox" class="whybox" hidden>
<div class="whybox-title">Required:</div>
<ul id="whyList"></ul>
</div>
</div>
</section>
<section class="panel">
<div class="canvasWrap">
<canvas id="threeCanvas"></canvas>
</div>
<div class="output">
<div id="progress" class="progress"></div>
<div id="result"></div>
</div>
</section>
</main>
<footer>
<small>:33333333333333</small>
</footer>
<!-- local vendor three min js -->
<script src="/assets/vendor/three.min.js"></script>
<script src="/assets/vendor/pako.min.js"></script>
<script src="/assets/vendor/upng.min.js"></script>
<script src="/assets/mc-app.js"></script>
</body>
</html>