@@ -434,7 +434,7 @@ addCanvas(2, (ctx, width, height, animate) => {
434434addCanvas (
435435 1.3 ,
436436 ( ctx , width , height , animate ) => {
437- const period = Math . PI ** Math . E * 1000 ;
437+ const period = ( Math . E / Math . PI ) * 1000 ;
438438 const center : Coord = { x : width * 0.5 , y : height * 0.5 } ;
439439
440440 const blob = centeredBlob (
@@ -447,18 +447,20 @@ addCanvas(
447447 center ,
448448 ) ;
449449
450+ const shiftedBlob = shift ( 1 , blob ) ;
451+
452+ let prev = 0 ;
453+ let count = 0 ;
450454 animate ( ( frameTime ) => {
451455 const animationTime = mod ( frameTime , period ) ;
452- const totalShifts = blob . length ;
453- const localPeriod = period / totalShifts ;
456+ const percentage = timingFunctions . ease ( mod ( animationTime , period ) / period ) ;
454457
455- const shiftNumber = Math . floor ( ( animationTime / period ) * totalShifts ) ;
456- const localPercentage = timingFunctions . ease (
457- mod ( animationTime , localPeriod ) / localPeriod ,
458- ) ;
459-
460- const prevBlob = shift ( shiftNumber - 1 , blob ) ;
461- const currentBlob = shift ( shiftNumber , blob ) ;
458+ // Count animation loops.
459+ if ( percentage < prev ) {
460+ count ++ ;
461+ console . log ( count ) ;
462+ }
463+ prev = percentage ;
462464
463465 // Draw lines points are travelling.
464466 tempStyles (
@@ -475,11 +477,12 @@ addCanvas(
475477 } ,
476478 ) ;
477479
478- drawClosed (
479- ctx ,
480- interpolateBetweenSmooth ( 2 , localPercentage , prevBlob , currentBlob ) ,
481- true ,
482- ) ;
480+ // Pause in-place every other animation loop.
481+ if ( count % 2 === 0 ) {
482+ drawClosed ( ctx , interpolateBetweenSmooth ( 2 , percentage , blob , shiftedBlob ) , true ) ;
483+ } else {
484+ drawClosed ( ctx , blob , true ) ;
485+ }
483486 } ) ;
484487
485488 return `Points cannot be swapped without resulting in a different shape. However, a likely
0 commit comments