Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
…into main
  • Loading branch information
jianchengwang committed Dec 17, 2020
2 parents 6f3d674 + 273b578 commit e8e9f83
Show file tree
Hide file tree
Showing 4 changed files with 160 additions and 138 deletions.
14 changes: 7 additions & 7 deletions assets/js/charData.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,24 +32,24 @@ var charData = {
// "Z46 (First Summer)": "z46_2",

"Eldridge (New Year's Handholding)": "aierdeliqi_4",
"Centaur (Undine of the Beach)": "banrenma_2",
// "Centaur (Undine of the Beach)": "banrenma_2",
"Javelin": "biaoqiang",
"Javelin (Beach Picnic!)": "biaoqiang_3",
"Fubuki (Music Pixy)": "chuixue_3",
"Cleveland (Gentry Knight)": "kelifulan_3",
"Laffey": "lafei",
"Laffey (New Year Rabbit)": "lafei_4",
"Yukikaze": "xuefeng",
"Ibuki (Wish of a Snow Goddess)": "yichui_2",
// "Ibuki (Wish of a Snow Goddess)": "yichui_2",

"dujiaoshou_6": "dujiaoshou_6",
// "dujiaoshou_6": "dujiaoshou_6",
"edu_3": "edu_3",
"xuefeng_3": "xuefeng_3",

"1014100aqua": "1014100aqua",
"1024100": "1024100",
"1033113": "1033113",
"1044100": "1044100"
// "1014100aqua": "1014100aqua",
// "1024100": "1024100",
// "1033113": "1033113",
// "1044100": "1044100"


};
9 changes: 9 additions & 0 deletions assets/js/lib/live2dcubismcore.min.js

Large diffs are not rendered by default.

24 changes: 12 additions & 12 deletions assets/js/live2dv3.init.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,10 @@
// 兼容低版本浏览器
document.write('<script src="https://unpkg.com/core-js-bundle@3.6.1/minified.js"></script>');
// 音频播放
document.write('<script src="https://cdn.jsdelivr.net/npm/howler@2.1.3/dist/howler.min.js"></script>');
// document.write('<script src="https://cdn.jsdelivr.net/npm/howler@2.1.3/dist/howler.min.js"></script>');
// 必需
document.write('<script src="https://cubism.live2d.com/sdk-web/cubismcore/live2dcubismcore.min.js"></script>');
// document.write('<script src="https://cubism.live2d.com/sdk-web/cubismcore/live2dcubismcore.min.js"></script>');
document.write('<script src="https://cdn.jsdelivr.net/gh/jianchengwang/live2d_models@main/assets/js/lib/live2dcubismcore.min.js"></script>');
// live2dv3.js
document.write('<script src="https://cdn.jsdelivr.net/gh/jianchengwang/live2d_models@main/assets/js/live2dv3.js"></script>');
// 内置角色
Expand All @@ -14,7 +15,7 @@ document.write('<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/font-a
document.write('<link rel="stylesheet" href="https://cdn.jsdelivr.net/gh/jianchengwang/live2d_models@main/assets/css/live2dv3.init.css">');

// 创建看板娘div
document.write(
document.write(
`<div id="l2d-toggle" class="" style="visibility:hidden;">
<span>看版娘</span>
</div>
Expand All @@ -41,7 +42,7 @@ window.onload = () => {
// 创建l2dv
var l2dv
function createL2dv() {
if(!l2dv) {
if (!l2dv) {
l2dv = new L2dViewer({
el: document.getElementById('L2dCanvas'),
// modelHomePath: './assets/model/',
Expand All @@ -60,7 +61,7 @@ function createL2dv() {
}, 2000);
}
// 注册事件
registerEventListener();
registerEventListener();
}

// 监听事件
Expand Down Expand Up @@ -89,7 +90,7 @@ function registerEventListener() {
document.getElementById("l2d-toggle").addEventListener("click", showModel);

// other
const devtools = () => {};
const devtools = () => { };
console.log("%c", devtools);
devtools.toString = () => {
showMessage("哈哈,你打开了控制台,是想要看看我的小秘密吗?", 4000, 9);
Expand Down Expand Up @@ -126,16 +127,16 @@ function showModel() {
// 加载model
function loadModel(modelName) {
showMessage("正在切换看板娘...", 6000, 1);
if(modelName instanceof MouseEvent) {
if (modelName instanceof MouseEvent) {
modelName = randomChar();
} else if(!modelName) {
if(document.getElementById('modelName')) {
} else if (!modelName) {
if (document.getElementById('modelName')) {
modelName = document.getElementById('modelName').value
} else {
modelName = randomChar();
}
}
console.info(modelName + ' loading....' )
console.info(modelName + ' loading....')
l2dv.loadModel(modelName)
}

Expand All @@ -162,7 +163,7 @@ function showHitokoto() {
// 显示tip消息
function showMessage(text, timeout, priority) {
if (!text) return;
if(!timeout) timeout = 1000;
if (!timeout) timeout = 1000;
const tips = document.getElementById("l2d-tips");
tips.innerHTML = text;
tips.classList.add("l2d-tips-active");
Expand All @@ -171,4 +172,3 @@ function showMessage(text, timeout, priority) {
tips.classList.remove("l2d-tips-active");
}, timeout);
}

Loading

0 comments on commit e8e9f83

Please sign in to comment.