微件:Live2d:修订间差异
跳转到导航
跳转到搜索
无编辑摘要 |
无编辑摘要 |
||
| 第11行: | 第11行: | ||
<script src='https://cruiseliu.github.io/live2d-demo/src/LAppModel.js'></script> | <script src='https://cruiseliu.github.io/live2d-demo/src/LAppModel.js'></script> | ||
<script> | <script> | ||
var | var l2d_index = "<!--{$index|escape:'quotes'}-->"; | ||
var l2d_url = '/wg_img/ccbResources/live2D/' + l2d_index '/model.model.json'; | |||
var l2d_canvas = null; | var l2d_canvas = null; | ||
| 第23行: | 第24行: | ||
var l2d_config = null; | var l2d_config = null; | ||
var l2d_triggers = [ ]; | var l2d_triggers = [ ]; | ||
var l2d_eyeY = 0.9; | |||
function live2d_main() | function live2d_main() | ||
{ | { | ||
// I don't know how to calculate eyes' coordinate, so hard coded here | |||
if (l2d_index == '59_1') | |||
l2d_eyeY = 0.945; | |||
else if (l2d_index == '248_1') | |||
l2d_eyeY = 0.885; | |||
l2d_canvas = document.getElementById('live2d-canvas'); | l2d_canvas = document.getElementById('live2d-canvas'); | ||
var bg = document.getElementById('live2d-background').style; | var bg = document.getElementById('live2d-background').style; | ||
| 第157行: | 第166行: | ||
var y = transformViewY(event.clientY - rect.top); | var y = transformViewY(event.clientY - rect.top); | ||
l2d_dragMgr.setPoint(x, y); | l2d_dragMgr.setPoint(x, y - l2d_eyeY); | ||
l2d_dragging = true; | l2d_dragging = true; | ||
| 第182行: | 第191行: | ||
if (l2d_dragging) { | if (l2d_dragging) { | ||
l2d_dragMgr.setPoint(x, y); | l2d_dragMgr.setPoint(x, y - l2d_eyeY); | ||
if (l2d_strokeStart != null) { | if (l2d_strokeStart != null) { | ||
2016年10月5日 (三) 19:24的版本
WIP