@@ -200,7 +200,10 @@ function showInteractionHint(container, theme) {
200200 const dark = theme === "dark" ;
201201 const wrap = document . createElement ( "div" ) ;
202202 wrap . className = "usf-interaction-hint" ;
203- wrap . innerHTML = `<div class="usf-hint-hand">${ handSVG ( dark ) } </div>` ;
203+ wrap . innerHTML =
204+ `<div class="usf-hint-hand-wrap">` +
205+ `<div class="usf-hint-hand usf-hint-hand--pan">${ handSVG ( dark ) } </div>` +
206+ `</div>` ;
204207 container . appendChild ( wrap ) ;
205208 return wrap ;
206209}
@@ -644,30 +647,52 @@ async function main() {
644647 let hintDismissed = hintAlreadyDismissed ;
645648 let hintTimers = [ ] ;
646649
647- const hintHand = hint . querySelector ( ".usf-hint-hand" ) ;
650+ const hintPanInner = hint . querySelector ( ".usf-hint-hand--pan" ) ;
651+
652+ const restartPanAnim = ( ) => {
653+ hintPanInner . style . animation = "none" ;
654+ void hintPanInner . offsetWidth ;
655+ hintPanInner . style . animation = "" ;
656+ } ;
648657
649658 if ( hintAlreadyDismissed ) {
650659 hint . remove ( ) ;
651660 } else {
652- const scheduleHintPulse = ( ) => {
661+ const PAN_MS = 2800 ;
662+ const FADE_MS = 450 ;
663+ const GAP_MS = 2800 ;
664+ const INITIAL_DELAY_MS = 800 ;
665+
666+ const scheduleHintCycle = ( isFirstCycle ) => {
653667 if ( hintDismissed ) return ;
654- const t1 = setTimeout ( ( ) => {
655- if ( hintDismissed ) return ;
656- hintHand . style . animation = "none" ;
657- void hintHand . offsetWidth ;
658- hintHand . style . animation = "" ;
659- hint . classList . add ( "visible" ) ;
660- } , 800 ) ;
661- const t2 = setTimeout ( ( ) => {
662- if ( hintDismissed ) return ;
663- hint . classList . remove ( "visible" ) ;
664- const t3 = setTimeout ( ( ) => scheduleHintPulse ( ) , 3000 ) ;
665- hintTimers . push ( t3 ) ;
666- } , 3600 ) ;
667- hintTimers . push ( t1 , t2 ) ;
668+ let acc = isFirstCycle ? INITIAL_DELAY_MS : GAP_MS ;
669+
670+ hintTimers . push (
671+ setTimeout ( ( ) => {
672+ if ( hintDismissed ) return ;
673+ restartPanAnim ( ) ;
674+ hint . classList . add ( "visible" ) ;
675+ } , acc ) ,
676+ ) ;
677+
678+ acc += PAN_MS ;
679+ hintTimers . push (
680+ setTimeout ( ( ) => {
681+ if ( hintDismissed ) return ;
682+ hint . classList . remove ( "visible" ) ;
683+ } , acc ) ,
684+ ) ;
685+
686+ acc += FADE_MS ;
687+ hintTimers . push (
688+ setTimeout ( ( ) => {
689+ if ( hintDismissed ) return ;
690+ scheduleHintCycle ( false ) ;
691+ } , acc ) ,
692+ ) ;
668693 } ;
669694
670- scheduleHintPulse ( ) ;
695+ scheduleHintCycle ( true ) ;
671696
672697 const dismissHint = ( broadcast = true ) => {
673698 hintDismissed = true ;
0 commit comments