@@ -129,6 +129,8 @@ export function EntryCutscene({ onComplete }: EntryCutsceneProps) {
129129 } ;
130130
131131 useEffect ( ( ) => {
132+ const currentTimers = timers . current ;
133+
132134 // Only show once per browser session
133135 if ( sessionStorage . getItem ( SESSION_KEY ) ) {
134136 onComplete ?.( ) ;
@@ -154,14 +156,14 @@ export function EntryCutscene({ onComplete }: EntryCutsceneProps) {
154156
155157 const totalDuration = FRAME_DURATION_MS * frames . length ;
156158
157- timers . current . cycle = setInterval ( ( ) => {
159+ currentTimers . cycle = setInterval ( ( ) => {
158160 setFrameIndex ( ( prev ) => ( prev + 1 < frames . length ? prev + 1 : prev ) ) ;
159161 } , FRAME_DURATION_MS ) ;
160162
161- timers . current . fade = setTimeout ( ( ) => setFading ( true ) , totalDuration - FADE_LEAD_MS ) ;
163+ currentTimers . fade = setTimeout ( ( ) => setFading ( true ) , totalDuration - FADE_LEAD_MS ) ;
162164
163165 const scheduleMusic = ( delay : number ) => {
164- timers . current . music = setTimeout ( ( ) => {
166+ currentTimers . music = setTimeout ( ( ) => {
165167 startAudioWithFade ( ) . catch ( ( ) => {
166168 // Playback blocked: prompt user
167169 setNeedsUserAudio ( true ) ;
@@ -171,20 +173,20 @@ export function EntryCutscene({ onComplete }: EntryCutsceneProps) {
171173
172174 scheduleMusic ( MUSIC_DELAY_MS ) ;
173175
174- timers . current . hide = setTimeout ( ( ) => {
176+ currentTimers . hide = setTimeout ( ( ) => {
175177 fadeOutAndStop ( ) . finally ( ( ) => {
176178 setVisible ( false ) ;
177179 onComplete ?.( ) ;
178180 } ) ;
179181 } , totalDuration ) ;
180182
181183 return ( ) => {
182- if ( timers . current . cycle ) clearInterval ( timers . current . cycle ) ;
183- if ( timers . current . fade ) clearTimeout ( timers . current . fade ) ;
184- if ( timers . current . hide ) clearTimeout ( timers . current . hide ) ;
185- if ( timers . current . music ) clearTimeout ( timers . current . music ) ;
186- if ( timers . current . fadeIn ) clearInterval ( timers . current . fadeIn ) ;
187- if ( timers . current . fadeOut ) clearInterval ( timers . current . fadeOut ) ;
184+ if ( currentTimers . cycle ) clearInterval ( currentTimers . cycle ) ;
185+ if ( currentTimers . fade ) clearTimeout ( currentTimers . fade ) ;
186+ if ( currentTimers . hide ) clearTimeout ( currentTimers . hide ) ;
187+ if ( currentTimers . music ) clearTimeout ( currentTimers . music ) ;
188+ if ( currentTimers . fadeIn ) clearInterval ( currentTimers . fadeIn ) ;
189+ if ( currentTimers . fadeOut ) clearInterval ( currentTimers . fadeOut ) ;
188190 if ( audioRef . current ) {
189191 audioRef . current . pause ( ) ;
190192 audioRef . current . currentTime = 0 ;
0 commit comments