From 43ffcf7e8f7150666c86418eee207b67893702ca Mon Sep 17 00:00:00 2001 From: Thomas <9749173+uhthomas@users.noreply.github.com> Date: Fri, 16 Jun 2023 03:27:32 +0100 Subject: [PATCH] use animation frames for memory autoplay (#2771) The current implementation mixes intervals and animation frames, which is a little convoluted. The use of intervals means that the animation is not going to be smooth and may have strange behaviour when the window is moved to the background. It's possible that the current animation frames could pile up and run all at once which would be undesirable. Moving everything into animation frames means the code is simpler and easier to reason about. It should also be more performant and less buggy. Co-authored-by: Alex Tran --- .../memory-page/memory-viewer.svelte | 254 ++++++++---------- .../components/photos-page/memory-lane.svelte | 2 +- 2 files changed, 112 insertions(+), 144 deletions(-) diff --git a/web/src/lib/components/memory-page/memory-viewer.svelte b/web/src/lib/components/memory-page/memory-viewer.svelte index 5e2651c001..878cb88e8c 100644 --- a/web/src/lib/components/memory-page/memory-viewer.svelte +++ b/web/src/lib/components/memory-page/memory-viewer.svelte @@ -1,8 +1,9 @@
@@ -170,19 +133,20 @@ {#if !galleryInView}
- +
- +

- {autoPlayIndex + 1}/{currentMemory.assets.length} + {assetIndex + 1}/{currentMemory.assets.length}

@@ -211,28 +175,28 @@
@@ -247,29 +211,33 @@
- + {#if previousMemory || previousAsset} + + {/if}
- + {#if canAdvance} + + {/if}
- {#key currentMemory.assets[autoPlayIndex].id} + {#key currentAsset.id} @@ -282,8 +250,8 @@ )}

- {currentMemory.assets[autoPlayIndex].exifInfo?.city || ''} - {currentMemory.assets[autoPlayIndex].exifInfo?.country || ''} + {currentAsset.exifInfo?.city || ''} + {currentAsset.exifInfo?.country || ''}

@@ -292,25 +260,25 @@