diff --git a/spine-ts/player/src/Player.ts b/spine-ts/player/src/Player.ts index 5075744ae..e6bf93570 100644 --- a/spine-ts/player/src/Player.ts +++ b/spine-ts/player/src/Player.ts @@ -210,10 +210,6 @@ module spine { this.bgFullscreen.setFromString(config.fullScreenBackgroundColor); this.parent.appendChild(this.create()); - if (!config.alpha) { // Prevents a flash before the first frame is drawn. - let hex = config.backgroundColor; - this.parent.style.backgroundColor = (hex.charAt(0) == '#' ? hex : "#" + hex).substr(0, 7); - } // Register a global resize handler to redraw, avoiding flicker. window.addEventListener("resize", () => this.drawFrame(false)); @@ -264,6 +260,11 @@ module spine { let dom = this.dom = createElement( /*html*/`
${controls}
`); + if (!config.alpha) { // Prevents a flash before the first frame is drawn. + let hex = config.backgroundColor; + this.dom.style.backgroundColor = (hex.charAt(0) == '#' ? hex : "#" + hex).substr(0, 7); + } + try { // Setup the OpenGL context. this.canvas = findWithClass(dom, "spine-player-canvas") as HTMLCanvasElement;