From a19c2facbf99f450d7c240f112acb0a5d827717b Mon Sep 17 00:00:00 2001 From: Matchu Date: Fri, 2 Jul 2021 15:40:04 -0700 Subject: [PATCH] Detect more animated items Okay cool, I noticed that "A Warm Winters Night Background" sometimes animates when other things are playing, but the animations aren't _detected_. (Huh, I actually thought we just didn't schedule ticks in that case? But maybe I'm missing something.) Anyway, some movies don't use the built-in frames construct to animate, and instead use tweens that hook into the timeline and mutate the stage. Okay! Now we detect those. This _did_ enable the Play/Pause button on some items that don't actually animate in practice, like the "#1 Fan Room Background", which seems to have an animated string of lights in the corner that got layered incorrectly. Maybe we should add a new glitch type, to flag movies that don't actually animate? --- src/app/components/OutfitMovieLayer.js | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/app/components/OutfitMovieLayer.js b/src/app/components/OutfitMovieLayer.js index 720e9ad..07a2911 100644 --- a/src/app/components/OutfitMovieLayer.js +++ b/src/app/components/OutfitMovieLayer.js @@ -453,7 +453,12 @@ export function buildMovieClip(library, libraryUrl) { */ export function hasAnimations(createjsNode) { return ( + // Some nodes have simple animation frames. createjsNode.totalFrames > 1 || + // Tweens are a form of animation that can happen separately from frames. + // They expect timer ticks to happen, and they change the scene accordingly. + createjsNode?.timeline?.tweens?.length >= 1 || + // And some nodes have _children_ that are animated. (createjsNode.children || []).some(hasAnimations) ); }