lingo3d
Version:
Lingo3D is a React/Vue 3d game development framework that ships with a complete visual editor
62 lines • 1.98 kB
JavaScript
import Appendable from "../display/core/Appendable";
import { uiContainer } from "../engine/renderLoop/containers";
import { splashScreenDefaults, splashScreenSchema } from "../interface/ISplashScreen";
import createElement from "../utils/createElement";
let initialized = false;
const initCSS = () => {
if (initialized)
return;
initialized = true;
const style = createElement(`
<style>
.lingo3d-splashscreen {
position: absolute;
top: 0px;
left: 0px;
width: 100%;
height: 100%;
display: flex;
justify-content: center;
align-items: center;
color: white;
background: black;
}
</style>
`);
document.head.appendChild(style);
};
class SplashScreen extends Appendable {
static componentName = "splashScreen";
static defaults = splashScreenDefaults;
static schema = splashScreenSchema;
splashScreen = createElement(`<div class="lingo3d-splashscreen" style="opacity: 1"></div>`);
textContainer = document.createElement("div");
constructor() {
super();
initCSS();
uiContainer.appendChild(this.splashScreen);
this.splashScreen.appendChild(this.textContainer);
}
disposeNode() {
super.disposeNode();
this.splashScreen.remove();
}
get opacity() {
return Number(this.splashScreen.style.opacity);
}
set opacity(value) {
this.splashScreen.style.opacity = value + "";
}
get textCenter() {
return this.textContainer.style.textAlign === "center";
}
set textCenter(value) {
this.textContainer.style.textAlign = value ? "center" : "";
}
$appendNode(child) {
super.$appendNode(child);
this.textContainer.appendChild(child.el);
}
}
export default SplashScreen;
//# sourceMappingURL=SplashScreen.js.map