Browse Source

🎉

master
Gaëtan Renaudeau 7 years ago
parent
commit
351ca25b3f
  1. 46
      src/index.ejs
  2. BIN
      static/images/tmp_logo_will_be_svg_later.png
  3. BIN
      static/videos/loader.mp4

46
src/index.ejs

@ -24,9 +24,32 @@
z-index: 100; z-index: 100;
} }
#preload video { #preload .logo {
height: 144px; height: 100px;
width: 256px; width: 100px;
animation: logo 4s infinite 1s;
transform-origin: 50% 50%;
}
@keyframes logo {
from, to {
transform: rotate(0deg);
}
10% {
transform: rotate(0deg);
}
30% {
transform: rotate(360deg);
}
40% {
transform: rotate(360deg);
}
60% {
transform: rotate(720deg);
}
70% {
transform: rotate(720deg);
}
} }
</style> </style>
@ -41,7 +64,7 @@
</head> </head>
<body> <body>
<div id="preload"> <div id="preload">
<video autoplay loop muted src="<%= __DEV__ ? '.' : '../static' %>/videos/loader.mp4" /> <img class="logo" src="<%= __DEV__ ? '.' : '../static' %>/images/tmp_logo_will_be_svg_later.png" alt="" />
</div> </div>
<div id="app"></div> <div id="app"></div>
<script> <script>
@ -52,6 +75,7 @@
const appEl = document.getElementById('app') const appEl = document.getElementById('app')
const initApp = (options = {}) => { const initApp = (options = {}) => {
return
const { force = false } = options const { force = false } = options
if (force) { if (force) {
@ -65,17 +89,11 @@
if (name === 'MainWindow') { if (name === 'MainWindow') {
preloadEl.style.display = 'flex' preloadEl.style.display = 'flex'
const startTime = Date.now()
let waitTime = 0 const PRELOAD_WAIT_TIME_MIN = 2000
const PRELOAD_WAIT_TIME_MIN = 2e3
const interval = setInterval(() => (waitTime += 250), 250)
window.onAppReady = () => { window.onAppReady = () => {
const delay = PRELOAD_WAIT_TIME_MIN - waitTime const delay = Math.max(0, PRELOAD_WAIT_TIME_MIN - (Date.now() - startTime))
setTimeout(initApp, delay)
clearInterval(interval)
setTimeout(initApp, delay > 0 ? delay : 1)
} }
} else { } else {
initApp({ force: true }) initApp({ force: true })

BIN
static/images/tmp_logo_will_be_svg_later.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 55 KiB

BIN
static/videos/loader.mp4

Binary file not shown.
Loading…
Cancel
Save