From a5bfadf126728f3f7649e3b62ac12955b5507301 Mon Sep 17 00:00:00 2001 From: Matchu Date: Sun, 8 Nov 2020 16:17:07 -0800 Subject: [PATCH] fix missing pause/play button for some animations We do animation detection during the preload now, but this wasn't always working correctly: some movies don't actually fully mount the children onto the stage until we start playing. This caused the play/pause button to be missing on the outfit page and the item page, but the animations would still play, depending on the user's saved play/pause state in localStorage. --- src/app/components/OutfitPreview.js | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/app/components/OutfitPreview.js b/src/app/components/OutfitPreview.js index 4c66c46..a1a322c 100644 --- a/src/app/components/OutfitPreview.js +++ b/src/app/components/OutfitPreview.js @@ -356,6 +356,12 @@ export function usePreloadLayers(layers) { return; } + // Some movie clips require you to tick to the first frame of the movie + // before the children mount onto the stage. If we detect animations + // without doing this, we'll say no, because we see no children! + // Example: http://images.neopets.com/cp/items/data/000/000/235/235877_6d273e217c/235877.js + movieClips.forEach((mc) => mc.advance()); + setLayersHaveAnimations(movieClips.some(hasAnimations)); setLoadedLayers(layers); };