mirror of
https://github.com/Buriburizaem0n/live2d.git
synced 2026-02-04 03:20:02 +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
|
// read json file to find motion groups
|
||||||
let modelJson = await readJSON(`${jsonpath}`);
|
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
|
// change expression after click on model
|
||||||
model.on("pointerdown", () => {
|
model.on("pointerdown", () => {
|
||||||
model.expression();
|
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
|
// function to read json file
|
||||||
|
|||||||
@@ -249,18 +249,14 @@ function loadWidget() {
|
|||||||
|
|
||||||
// read json file to find motion groups
|
// read json file to find motion groups
|
||||||
let modelJson = await readJSON(`${jsonpath}`);
|
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
|
// change expression after click on model
|
||||||
model.on("pointerdown", () => {
|
model.on("pointerdown", () => {
|
||||||
model.expression();
|
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
|
// function to read json file
|
||||||
|
|||||||
@@ -100,7 +100,7 @@
|
|||||||
cursor: grab;
|
cursor: grab;
|
||||||
height: 280px;
|
height: 280px;
|
||||||
position: relative;
|
position: relative;
|
||||||
width: 300px;
|
width: 330px;
|
||||||
/* z-index: -1; */
|
/* z-index: -1; */
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user