78 lines
2.7 KiB
Plaintext
78 lines
2.7 KiB
Plaintext
--- skin3d.js
|
|
+++ skin3d.js
|
|
@@ -1,52 +1,29 @@
|
|
-window.onload = function() {
|
|
+window.onload = async function() {
|
|
document.getElementById("cape").addEventListener("click", () => { set_cape_type("cape") }, false);
|
|
document.getElementById("cape").checked = true;
|
|
document.getElementById("elytra").addEventListener("click", () => { set_cape_type("elytra") }, false );
|
|
document.getElementById("elytra").checked = false;
|
|
-}
|
|
-
|
|
-
|
|
-const username = await(await fetch("/api/getUsername")).json();
|
|
|
|
-let skinViewer = new skinview3d.SkinViewer({
|
|
- canvas: document.getElementById("skin_container"),
|
|
- width: 300,
|
|
- height: 400,
|
|
- skin: `https://launcher.foxarmy.org/skins/${username}.png`,
|
|
- cape: `https://launcher.foxarmy.org/cloaks/${username}.png`
|
|
-});
|
|
|
|
-skinViewer.width = 300;
|
|
-skinViewer.height = 400;
|
|
-skinViewer.nameTag = username;
|
|
-skinViewer.loadPanorama("images/panorama.jpeg");
|
|
-skinViewer.fov = 120;
|
|
-skinViewer.zoom = 0.65;
|
|
-skinViewer.autoRotate = true;
|
|
-
|
|
-function set_cape_type(type) {
|
|
- skinViewer.loadCape(`https://launcher.foxarmy.org/cloaks/${username}.png`, { backEquipment: type });
|
|
+ const username = await (await (fetch("/api/getUsername"))).text();
|
|
+
|
|
+ let skinViewer = new skinview3d.SkinViewer({
|
|
+ canvas: document.getElementById("skin_container"),
|
|
+ width: 300,
|
|
+ height: 400,
|
|
+ skin: `https://launcher.foxarmy.org/skins/${username}.png`,
|
|
+ cape: `https://launcher.foxarmy.org/cloaks/${username}.png`
|
|
+ });
|
|
+
|
|
+ skinViewer.width = 300;
|
|
+ skinViewer.height = 400;
|
|
+ skinViewer.nameTag = username;
|
|
+ skinViewer.loadPanorama("images/panorama.jpeg");
|
|
+ skinViewer.fov = 120;
|
|
+ skinViewer.zoom = 0.65;
|
|
+ skinViewer.autoRotate = true;
|
|
+
|
|
+ function set_cape_type(type) {
|
|
+ skinViewer.loadCape(`https://launcher.foxarmy.org/cloaks/${username}.png`, { backEquipment: type });
|
|
+ }
|
|
}
|
|
-
|
|
-
|
|
-
|
|
-// onload = () => {
|
|
-// alert(1);
|
|
-// // document.getElementById("cape").addEventListener("click", () => { set_cape_type("cape") }, false);
|
|
-// // document.getElementById("elytra").addEventListener("click", () => { set_cape_type("elytra") }, false );
|
|
-// document.getElementById("cape").addEventListener("click", a, false);
|
|
-// document.getElementById("elytra").addEventListener("click", a, false );
|
|
-
|
|
-
|
|
-// }
|
|
-
|
|
-
|
|
-
|
|
-// function set_cape_type_elytra() {
|
|
-// alert(2)
|
|
-// skinViewer.loadCape(`https://launcher.foxarmy.org/cloaks/${username}.png`, { backEquipment: "elytra" });
|
|
-// }
|
|
-
|
|
-// skinViewer.animation = new skinview3d.WalkingAnimation();
|
|
-// skinViewer.animation.speed = 3;
|
|
-// skinViewer.animation.paused = true;
|