changed logic

This commit is contained in:
2024-09-21 00:24:55 +02:00
parent f5e8ce4ebc
commit 11f8b42b79
3 changed files with 9 additions and 17 deletions

View File

@@ -44769,18 +44769,14 @@
// read json file to find motion groups
let modelJson = await readJSON(`${jsonpath}`);
// if model has motion groups
if (modelJson.motions) {
// change motion after 5-10s
setInterval(() => {
const motionGroup = Object.keys(modelJson.motions)[Math.floor(Math.random() * Object.keys(modelJson.motions).length)];
model.motion(motionGroup);
}, Math.floor(Math.random() * 5000) + 5000);
}
// change expression after click on model
model.on("pointerdown", () => {
model.expression();
if (modelJson.motions) {
const motionGroup = Object.keys(modelJson.motions)[Math.floor(Math.random() * Object.keys(modelJson.motions).length)];
model.motion(motionGroup);
}
});
// function to read json file

View File

@@ -249,18 +249,14 @@ function loadWidget() {
// read json file to find motion groups
let modelJson = await readJSON(`${jsonpath}`);
// if model has motion groups
if (modelJson.motions) {
// change motion after 5-10s
setInterval(() => {
const motionGroup = Object.keys(modelJson.motions)[Math.floor(Math.random() * Object.keys(modelJson.motions).length)];
model.motion(motionGroup);
}, Math.floor(Math.random() * 5000) + 5000);
}
// change expression after click on model
model.on("pointerdown", () => {
model.expression();
if (modelJson.motions) {
const motionGroup = Object.keys(modelJson.motions)[Math.floor(Math.random() * Object.keys(modelJson.motions).length)];
model.motion(motionGroup);
}
});
// function to read json file

View File

@@ -100,7 +100,7 @@
cursor: grab;
height: 280px;
position: relative;
width: 300px;
width: 330px;
/* z-index: -1; */
}