/** * Copyright(c) Live2D Inc. All rights reserved. * * Use of this source code is governed by the Live2D Open Software license * that can be found at https://www.live2d.com/eula/live2d-open-software-license-agreement_en.html. */ import "./core/live2dcubismcore.js"; import { LAppDelegate } from "./lappdelegate"; import { DefineConfig } from "./lappdefine"; import { LAppLive2DManager } from "./lapplive2dmanager"; class live2d { private live2dmanager: LAppLive2DManager | null = null; public initialize(config: { canvasWrapper: HTMLElement; canvas: HTMLCanvasElement; width: number; height: number; bgPath: string; bgName: string }): LAppLive2DManager | null { DefineConfig.getInstance({ ResourcesPath: config.bgPath, BackImageName: config.bgName }) let lappdelegate = LAppDelegate.getInstance(); if (lappdelegate.initialize(config) == false) { return null; } this.live2dmanager = LAppLive2DManager.getInstance(); lappdelegate.run(); return this.live2dmanager; } public release() { if (this.live2dmanager) { this.live2dmanager.releaseAllModel(); } LAppDelegate.releaseInstance(); } } export default live2d;