12.26
This commit is contained in:
@ -6,6 +6,7 @@ class BlendShapeAnimator {
|
||||
this.animationShapeNames = [];
|
||||
this.isPlaying = false;
|
||||
this.currentFrameIndex = 0;
|
||||
this.currentSentenceIndex = -1;
|
||||
this.animationStartTime = 0;
|
||||
this.idleAnimations = {};
|
||||
this.blendShapeScale = config.blendShapeScale || 1.0;
|
||||
@ -14,6 +15,7 @@ class BlendShapeAnimator {
|
||||
this.streamingComplete = true;
|
||||
this.streamingWaitStart = null;
|
||||
this.streamingStallMs = 0;
|
||||
this.sentenceTexts = []; // 句子文本列表
|
||||
|
||||
// 空闲动画参数
|
||||
this.blinkParams = config.blinkParams || {
|
||||
@ -254,6 +256,14 @@ class BlendShapeAnimator {
|
||||
}
|
||||
|
||||
this.currentFrameIndex = targetFrameIndex;
|
||||
|
||||
// 更新当前句子显示
|
||||
const sentenceIndex = currentFrame?.sentenceIndex ?? -1;
|
||||
if (sentenceIndex !== this.currentSentenceIndex) {
|
||||
this.currentSentenceIndex = sentenceIndex;
|
||||
this._updateCurrentSentenceDisplay();
|
||||
}
|
||||
|
||||
requestAnimationFrame(() => this._animateFrame());
|
||||
}
|
||||
|
||||
@ -514,6 +524,21 @@ class BlendShapeAnimator {
|
||||
return start + (end - start) * t;
|
||||
}
|
||||
|
||||
_updateCurrentSentenceDisplay() {
|
||||
const sentenceDiv = document.getElementById('currentSentence');
|
||||
const sentenceText = document.getElementById('sentenceText');
|
||||
|
||||
if (!sentenceDiv || !sentenceText) return;
|
||||
|
||||
if (this.currentSentenceIndex >= 0 && this.currentSentenceIndex < this.sentenceTexts.length) {
|
||||
sentenceDiv.style.display = 'block';
|
||||
sentenceText.textContent = this.sentenceTexts[this.currentSentenceIndex];
|
||||
console.log(`[前端调试] 显示句子 ${this.currentSentenceIndex}: ${this.sentenceTexts[this.currentSentenceIndex]}`);
|
||||
} else {
|
||||
sentenceDiv.style.display = 'none';
|
||||
}
|
||||
}
|
||||
|
||||
_applyEasing(t, type) {
|
||||
switch(type) {
|
||||
case 'easeOutQuad':
|
||||
|
||||
Reference in New Issue
Block a user