mirror of
https://github.com/Buriburizaem0n/live2d.git
synced 2025-12-15 07:31:06 +00:00
changed logic
This commit is contained in:
12
live2d/dist/waifu-tips.js
vendored
12
live2d/dist/waifu-tips.js
vendored
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -100,7 +100,7 @@
|
||||
cursor: grab;
|
||||
height: 280px;
|
||||
position: relative;
|
||||
width: 300px;
|
||||
width: 330px;
|
||||
/* z-index: -1; */
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user