From d417b97674647a5b7b61b23bfc2f2e55f630cf41 Mon Sep 17 00:00:00 2001 From: danbulant Date: Sat, 15 Feb 2020 19:58:35 +0100 Subject: [PATCH] Simple boot animation --- client/src/renderers/boot.ts | 26 +++++++++++++++++++ client/src/renderers/styles/boot.css | 37 ++++++++++++++++++++++++++++ 2 files changed, 63 insertions(+) create mode 100644 client/src/renderers/styles/boot.css diff --git a/client/src/renderers/boot.ts b/client/src/renderers/boot.ts index fd04852..83e04af 100644 --- a/client/src/renderers/boot.ts +++ b/client/src/renderers/boot.ts @@ -1,6 +1,15 @@ import RendererDef from '../defs/renderer'; import RenderStates from '../defs/renderStates'; +import Welcome from './welcome'; +import './styles/boot.css'; + +/* +A word why this is the only renderer that doesn't have prepare() function that prepares +rendering elements between actually rendering them. +It's quite simple: this is the first renderer to start, so we want to user to see +something as fast as possible, so they don't stare at white screen. +*/ export default class Boot implements RendererDef { name = "boot"; removePrevious = true; @@ -10,9 +19,26 @@ export default class Boot implements RendererDef { console.log("Boot renderer active"); this.state = RenderStates.Rendered; + const body = document.body; + + var boot = document.createElement("div"); + body.appendChild(boot); + boot.className = "boot-rendered"; + boot.id = "boot"; + + var text = document.createElement("div"); + text.innerText = "Booting Ester OS!"; + text.className = "boot-text"; + + boot.appendChild(text); + + var w = new Welcome(); + w.prepare().then(()=>{w.render()}); } eject(){ console.log("Boot renderer ejected"); this.state = RenderStates.Ejected; + + document.body.removeChild(document.getElementById("boot")); } } \ No newline at end of file diff --git a/client/src/renderers/styles/boot.css b/client/src/renderers/styles/boot.css new file mode 100644 index 0000000..7e9e7f4 --- /dev/null +++ b/client/src/renderers/styles/boot.css @@ -0,0 +1,37 @@ +@import url("/fonts/roboto/roboto_medium_macroman/stylesheet.css"); + +.boot-rendered { + position: fixed; + top: 0; + left: 0; + width: 100%; + height: 100%; + background-color: rgb(31, 31, 31); + color: white; + font-size: 30px; + font-family: "robotomedium"; + animation-name: boot-text-anim; + animation-duration: 2s; + animation-iteration-count: infinite; +} +@keyframes boot-text-anim { + 0% { + text-shadow: 0 0 0 rgb(255, 255, 255); + } + 50% { + text-shadow: 0 0 5px rgb(255, 255, 255); + } + 100% { + text-shadow: 0 0 0 rgb(255, 255, 255); + } +} +.boot-text { + position: fixed; + text-align: center; + width: 400px; + left: 50%; + margin-left: -200px; + height: 100px; + top: 50%; + margin-top: -50px; +} \ No newline at end of file