Browse Source

🎉

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

88
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,45 +64,40 @@
</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>
const { remote } = require('electron') const { remote } = require('electron')
const { name } = remote.getCurrentWindow() const { name } = remote.getCurrentWindow()
const preloadEl = document.getElementById('preload') const preloadEl = document.getElementById('preload')
const appEl = document.getElementById('app') const appEl = document.getElementById('app')
const initApp = (options = {}) => { const initApp = (options = {}) => {
const { force = false } = options return
const { force = false } = options
if (force) { if (force) {
preloadEl.remove() preloadEl.remove()
} else { } else {
preloadEl.style.opacity = 0 preloadEl.style.opacity = 0
preloadEl.addEventListener('transitionend', () => preloadEl.remove()) preloadEl.addEventListener('transitionend', () => preloadEl.remove())
} }
} }
if (name === 'MainWindow') {
preloadEl.style.display = 'flex'
let waitTime = 0
const PRELOAD_WAIT_TIME_MIN = 2e3
const interval = setInterval(() => (waitTime += 250), 250)
window.onAppReady = () => { if (name === 'MainWindow') {
const delay = PRELOAD_WAIT_TIME_MIN - waitTime preloadEl.style.display = 'flex'
const startTime = Date.now()
clearInterval(interval) const PRELOAD_WAIT_TIME_MIN = 2000
setTimeout(initApp, delay > 0 ? delay : 1) window.onAppReady = () => {
} const delay = Math.max(0, PRELOAD_WAIT_TIME_MIN - (Date.now() - startTime))
} else { setTimeout(initApp, delay)
initApp({ force: true }) }
} } else {
</script> initApp({ force: true })
}
</script>
</body> </body>
</html> </html>

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