首次播放不掉帧
This commit is contained in:
@ -12,6 +12,7 @@ class BlendShapeAnimator {
|
||||
this.idleAnimations = {};
|
||||
this.blendShapeScale = config.blendShapeScale || 1.0;
|
||||
this.dataFps = config.dataFps || 30;
|
||||
this.playbackSpeed = config.playbackSpeed || 1.0; // 播放倍速:0.5=慢速, 1.0=正常, 2.0=快速
|
||||
this.isStreaming = false;
|
||||
this.streamingComplete = true;
|
||||
this.streamingWaitStart = null;
|
||||
@ -333,7 +334,7 @@ class BlendShapeAnimator {
|
||||
}
|
||||
|
||||
const frameDuration = 1000 / this.dataFps;
|
||||
const elapsed = now - this.animationStartTime - this.streamingStallMs;
|
||||
const elapsed = (now - this.animationStartTime - this.streamingStallMs) * this.playbackSpeed;
|
||||
const exactFrame = elapsed / frameDuration;
|
||||
const targetFrameIndex = Math.floor(exactFrame);
|
||||
const frameProgress = exactFrame - targetFrameIndex;
|
||||
@ -710,6 +711,8 @@ class BlendShapeAnimator {
|
||||
updateConfig(key, value) {
|
||||
if (key === 'blendShapeScale') {
|
||||
this.blendShapeScale = value;
|
||||
} else if (key === 'playbackSpeed') {
|
||||
this.playbackSpeed = value;
|
||||
} else if (this[key]) {
|
||||
this[key] = value;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user