Misaki sure..
document.getElementById("uploadForm").addEventListener("submit", async function (e) {
e.preventDefault();
const formData = new FormData(this);
const res = await fetch("/uploads", {
method: "POST",
body: formData
});
const data = await res.json();
const jsonFiles = data.files.filter(f => f.originalname.endsWith(".json"));
const atlasFiles = data.files.filter(f => f.originalname.endsWith(".atlas"));
const imageFiles = data.files.filter(f => f.originalname.endsWith(".webp") || f.originalname.endsWith(".png") || f.originalname.endsWith(".jpg"));
if (jsonFiles.length !== 1) {
alert("Please upload the JSON file.");
return;
}
if (atlasFiles.length !== 1) {
alert("Please upload the ATLAS file.");
return;
}
if (imageFiles.length < 1) {
alert("Please upload image files (WEBP, PNG, or JPG).");
return;
}
const jsonUrl = `/uploads/${jsonFiles[0].originalname}`;
const atlasUrl = `/uploads/${atlasFiles[0].originalname}`;
document.getElementById("player-container").innerHTML = "";
new spine.SpinePlayer("player-container", {
jsonUrl: jsonUrl,
atlasUrl: atlasUrl,
showControls: true,
backgroundColor: "#eeeeee",
alpha: false,
preserveDrawingBuffer: true,
autoplay: true,
loop: false,
scale: 1,
premultipliedAlpha: false
});
});
here is the actual code i'm using for my project. I'm taking input files from user and playing the spine animations in the Spine Web Player.
But for some specific animations, i'm seeing the blur and distorted animations in the web player.
I've attached the exact part of the previous image that i uploaded, where you can see a white square block which is supposed to be hidden.
