From 31ff95cc5419d9e9c2da66487d62dc9a437f03ed Mon Sep 17 00:00:00 2001 From: perqin Date: Sat, 10 Jul 2021 16:26:54 +0800 Subject: [PATCH] fix: remove old model on loading new one --- waifu-tips.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/waifu-tips.js b/waifu-tips.js index 6b863b7..6278791 100755 --- a/waifu-tips.js +++ b/waifu-tips.js @@ -10,6 +10,9 @@ let pixiApp; */ async function loadlive2dPixi(jsonPath) { const model = await PIXI.live2d.Live2DModel.from(jsonPath); + if (pixiApp.stage.children.length > 0) { + pixiApp.stage.removeChildren(0); + } pixiApp.stage.addChild(model); const parentWidth = pixiApp.renderer.width; const parentHeight = pixiApp.renderer.height;