From e8bfc245065af3764fd4e97f12e70156deffdec7 Mon Sep 17 00:00:00 2001 From: Matchu Date: Tue, 22 Sep 2020 03:06:14 -0700 Subject: [PATCH] oh, I think I fixed the movie pausing bug! --- src/app/components/OutfitCanvas.js | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/app/components/OutfitCanvas.js b/src/app/components/OutfitCanvas.js index 20360d11..27df7cc7 100644 --- a/src/app/components/OutfitCanvas.js +++ b/src/app/components/OutfitCanvas.js @@ -40,11 +40,11 @@ function OutfitCanvas({ children, width, height }) { // Add the child, then slot it into the right place in the order. stage.addChild(child); stage.sortChildren((a, b) => a.DTI_zIndex - b.DTI_zIndex); - // Then update in bulk! - stage.update(); if (afterFirstDraw) { stage.on("drawend", afterFirstDraw, null, true); } + // NOTE: We don't bother firing an update, because we trust the ticker + // to do it on the next frame. }, [stage] ); @@ -52,7 +52,9 @@ function OutfitCanvas({ children, width, height }) { const removeChild = React.useCallback( (child) => { stage.removeChild(child); - stage.update(); + // NOTE: We don't bother firing an update, because we trust the ticker + // to do it on the next frame. (And, I don't understand why, but + // updating here actually paused remaining movies! So, don't!) }, [stage] ); @@ -239,7 +241,7 @@ export function OutfitCanvasMovie({ librarySrc, zIndex }) { library.properties.height ); movieClip.on("tick", () => { - console.log("clip tick", movieClip.framerate); + console.log("clip tick", movieClip.framerate, movieClip.currentFrame); movieClip.updateCache(); });