From 1a6fcf60a3980099e1bb34e29d13da4031c09b66 Mon Sep 17 00:00:00 2001 From: Garrett Johnson Date: Fri, 13 Dec 2024 16:38:53 +0900 Subject: [PATCH] Fix transition --- src/r3f/components/CameraTransition.jsx | 4 ++-- src/three/controls/CameraTransitionManager.js | 2 ++ 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/r3f/components/CameraTransition.jsx b/src/r3f/components/CameraTransition.jsx index f3070e014..241935103 100644 --- a/src/r3f/components/CameraTransition.jsx +++ b/src/r3f/components/CameraTransition.jsx @@ -139,13 +139,13 @@ export const CameraTransition = forwardRef( function CameraTransition( props, re const callback = () => invalidate(); manager.addEventListener( 'transition-start', callback ); - manager.addEventListener( 'transition-change', callback ); + manager.addEventListener( 'change', callback ); manager.addEventListener( 'transition-end', callback ); return () => { manager.removeEventListener( 'transition-start', callback ); - manager.removeEventListener( 'transition-change', callback ); + manager.removeEventListener( 'change', callback ); manager.removeEventListener( 'transition-end', callback ); }; diff --git a/src/three/controls/CameraTransitionManager.js b/src/three/controls/CameraTransitionManager.js index 4c9eacf3f..d323b3aea 100644 --- a/src/three/controls/CameraTransitionManager.js +++ b/src/three/controls/CameraTransitionManager.js @@ -75,7 +75,9 @@ export class CameraTransitionManager extends EventDispatcher { toggle() { + // reset the clock for cases where we're not calling "update" every frame this._target = this._target === 1 ? 0 : 1; + this._clock.getDelta(); }