基本使用方法
如下面代码一样,在HTML的head头内引入L2Dwidget.js即可在页面中引入动画。
<script src="https://unpkg.com/live2d-widget/lib/L2Dwidget.min.js"></script>
<script src="https://unpkg.com/live2d-widget/lib/L2Dwidget.0.min.js"></script>
<script>
L2Dwidget.init({
"model": {jsonPath:"https://unpkg.com/live2d-widget-model-shizuku@1.0.5/assets/shizuku.model.json","scale": 1 },
"display": { "position": "left", "width": 150, "height": 300,"hOffset": 0, "vOffset": -20 }
});
</script>
更改看板娘模型
在配置项中,“model”后面jsonPath对应的就是动画模型的json文件地址,不同模型,显示不同图形。 可选模型有:
小帅哥: https://unpkg.com/live2d-widget-model-chitose@1.0.5/assets/chitose.model.json
萌娘:https://unpkg.com/live2d-widget-model-shizuku@1.0.5/assets/shizuku.model.json
小可爱(女):https://unpkg.com/live2d-widget-model-koharu@1.0.5/assets/koharu.model.json
小可爱(男):https://unpkg.com/live2d-widget-model-haruto@1.0.5/assets/haruto.model.json
初音:https://unpkg.com/live2d-widget-model-miku@1.0.5/assets/miku.model.json
金发妹子:https://unpkg.com/live2d-widget-model-z16@1.0.5/assets/z16.model.json
https://unpkg.com/live2d-widget-model-chitose/assets/chitose.model.json
https://unpkg.com/live2d-widget-model-epsilon2_1@1.0.5/assets/Epsilon2.1.model.json
猫:https://unpkg.com/live2d-widget-model-tororo@1.0.5/assets/tororo.model.json
https://unpkg.com/live2d-widget-model-tsumiki@1.0.5/assets/tsumiki.model.json
https://unpkg.com/live2d-widget-model-nietzsche@1.0.5/assets/nietzsche.model.json