16 lines
597 B
JavaScript
16 lines
597 B
JavaScript
|
|
import Live2DController from './live2d-controller.js';
|
||
|
|
|
||
|
|
const controller = new Live2DController();
|
||
|
|
|
||
|
|
document.getElementById('controls').addEventListener('click', (event) => {
|
||
|
|
const button = event.target;
|
||
|
|
const motionIndex = button.getAttribute('data-motion');
|
||
|
|
if (motionIndex !== null) {
|
||
|
|
controller.playMotion('Idle', parseInt(motionIndex));
|
||
|
|
}
|
||
|
|
});
|
||
|
|
|
||
|
|
document.getElementById('loadModelButton').addEventListener('click', () => {
|
||
|
|
const modelName = document.getElementById('modelSelect').value;
|
||
|
|
controller.loadModel(`resouces/${modelName}/${modelName}.model3.json`);
|
||
|
|
});
|