From 162d3c8d039f9ab5322f247de6f535c767e28a69 Mon Sep 17 00:00:00 2001 From: Victor Giers Date: Wed, 1 Apr 2026 04:05:09 +0200 Subject: [PATCH] auto-git: [change] src/runtime-three/runtime-host.ts --- src/runtime-three/runtime-host.ts | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/runtime-three/runtime-host.ts b/src/runtime-three/runtime-host.ts index c363f2aa..4ad47179 100644 --- a/src/runtime-three/runtime-host.ts +++ b/src/runtime-three/runtime-host.ts @@ -522,7 +522,7 @@ export class RuntimeHost { mesh.visible = visible ?? !mesh.visible; } - private applyPlayAnimationAction(instanceId: string, clipName: string) { + private applyPlayAnimationAction(instanceId: string, clipName: string, loop: boolean | undefined) { const mixer = this.animationMixers.get(instanceId); const clips = this.instanceAnimationClips.get(instanceId); @@ -538,8 +538,12 @@ export class RuntimeHost { return; } + // LoopRepeat is the three.js default; LoopOnce plays the clip a single time then stops. + const action = mixer.clipAction(clip); + action.loop = loop === false ? 2200 /* THREE.LoopOnce */ : 2201 /* THREE.LoopRepeat */; + action.clampWhenFinished = loop === false; mixer.stopAllAction(); - mixer.clipAction(clip).play(); + action.reset().play(); } private applyStopAnimationAction(instanceId: string) {