'commit'
This commit is contained in:
@@ -20,6 +20,9 @@
|
||||
background-color: #dc3545; border: none; color: white;
|
||||
font-size: 16px; cursor: pointer; box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
|
||||
display: flex; align-items: center; justify-content: center;
|
||||
/* 确保按钮始终可见 */
|
||||
opacity: 1 !important;
|
||||
visibility: visible !important;
|
||||
}
|
||||
.record-button:hover { background-color: #c82333; }
|
||||
.stop-button {
|
||||
@@ -28,6 +31,9 @@
|
||||
font-size: 16px; cursor: pointer; box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
|
||||
display: flex; align-items: center; justify-content: center;
|
||||
display: none;
|
||||
/* 确保按钮始终可见 */
|
||||
opacity: 1 !important;
|
||||
visibility: visible !important;
|
||||
}
|
||||
.stop-button:hover { background-color: #5a6268; }
|
||||
.recording-indicator {
|
||||
@@ -65,10 +71,10 @@
|
||||
|
||||
<script src="https://l2dwidget.js.org/lib/L2Dwidget.min.js"></script>
|
||||
<script>
|
||||
// 模型配置
|
||||
// 模型配置 - 使用与Sample.html相同的CDN链接
|
||||
const models = {
|
||||
shizuku: { jsonPath: "https://unpkg.com/live2d-widget-model-shizuku@1.0.5/assets/shizuku.model.json", name: "志津子" },
|
||||
koharu: { jsonPath: "https://unpkg.com/live2d-widget-model-koharu@1.0.5/assets/koharu.model.json", name: "小春日和" },
|
||||
shizuku: { jsonPath: "https://unpkg.com/live2d-widget-model-shizuku@1.0.5/assets/shizuku.model.json", name: "小智" },
|
||||
koharu: { jsonPath: "https://unpkg.com/live2d-widget-model-koharu@1.0.5/assets/koharu.model.json", name: "小荷" },
|
||||
wanko: { jsonPath: "https://unpkg.com/live2d-widget-model-wanko@1.0.5/assets/wanko.model.json", name: "汪喵" }
|
||||
};
|
||||
|
||||
@@ -136,7 +142,7 @@
|
||||
}
|
||||
}
|
||||
|
||||
// 初始化看板娘
|
||||
// 初始化看板娘 - 简化为Sample.html的工作版本
|
||||
function initL2Dwidget() {
|
||||
const modelId = getUrlParam('id') || 'shizuku';
|
||||
const model = models[modelId] || models.shizuku;
|
||||
@@ -144,10 +150,16 @@
|
||||
document.getElementById('model-select').value = modelId;
|
||||
console.log('加载模型:', model.name, model.jsonPath);
|
||||
|
||||
// 初始化模型
|
||||
// 初始化模型 - 与Sample.html相同的配置
|
||||
L2Dwidget.init({
|
||||
"model": { "jsonPath": model.jsonPath, "scale": 1 },
|
||||
"display": { "position": "right", "width": 150, "height": 300, "hOffset": 0, "vOffset": -20 },
|
||||
"display": {
|
||||
"position": "right",
|
||||
"width": 150,
|
||||
"height": 300,
|
||||
"hOffset": 0,
|
||||
"vOffset": -20
|
||||
},
|
||||
"mobile": { "show": true, "scale": 0.5 },
|
||||
"react": { "opacityDefault": 0.8, "opacityOnHover": 1 },
|
||||
"dialog": { "enable": true, "script": {
|
||||
@@ -157,18 +169,20 @@
|
||||
});
|
||||
}
|
||||
|
||||
// 监听下拉框变化
|
||||
document.getElementById('model-select').addEventListener('change', function() {
|
||||
window.location.search = '?id=' + this.value;
|
||||
});
|
||||
|
||||
// 绑定录音按钮事件
|
||||
document.getElementById('startRecordBtn').addEventListener('click', startRecording);
|
||||
document.getElementById('stopRecordBtn').addEventListener('click', stopRecording);
|
||||
|
||||
// 页面加载完成后初始化
|
||||
window.onload = function() {
|
||||
// 直接初始化看板娘,不添加额外延迟
|
||||
initL2Dwidget();
|
||||
|
||||
// 监听下拉框变化
|
||||
document.getElementById('model-select').addEventListener('change', function() {
|
||||
window.location.search = '?id=' + this.value;
|
||||
});
|
||||
|
||||
// 绑定录音按钮事件
|
||||
document.getElementById('startRecordBtn').addEventListener('click', startRecording);
|
||||
document.getElementById('stopRecordBtn').addEventListener('click', stopRecording);
|
||||
|
||||
// 页面加载时请求麦克风权限
|
||||
navigator.mediaDevices.getUserMedia({ audio: true })
|
||||
.then(stream => {
|
||||
|
Reference in New Issue
Block a user