mirror of
https://github.com/stevenjoezhang/live2d-widget.git
synced 2024-11-22 12:39:59 +08:00
fix: remove old model on loading new one
This commit is contained in:
parent
5649bbf5b6
commit
31ff95cc54
@ -10,6 +10,9 @@ let pixiApp;
|
|||||||
*/
|
*/
|
||||||
async function loadlive2dPixi(jsonPath) {
|
async function loadlive2dPixi(jsonPath) {
|
||||||
const model = await PIXI.live2d.Live2DModel.from(jsonPath);
|
const model = await PIXI.live2d.Live2DModel.from(jsonPath);
|
||||||
|
if (pixiApp.stage.children.length > 0) {
|
||||||
|
pixiApp.stage.removeChildren(0);
|
||||||
|
}
|
||||||
pixiApp.stage.addChild(model);
|
pixiApp.stage.addChild(model);
|
||||||
const parentWidth = pixiApp.renderer.width;
|
const parentWidth = pixiApp.renderer.width;
|
||||||
const parentHeight = pixiApp.renderer.height;
|
const parentHeight = pixiApp.renderer.height;
|
||||||
|
Loading…
Reference in New Issue
Block a user