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?
This commit is contained in:
Emi Matchu 2021-07-02 15:40:04 -07:00
parent dcfcbf9ff7
commit a19c2facbf

View file

@ -453,7 +453,12 @@ export function buildMovieClip(library, libraryUrl) {
*/ */
export function hasAnimations(createjsNode) { export function hasAnimations(createjsNode) {
return ( return (
// Some nodes have simple animation frames.
createjsNode.totalFrames > 1 || 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) (createjsNode.children || []).some(hasAnimations)
); );
} }