How do I - percentage-wise - set a loading.js splash SVG-image. It seems it only takes px-setting, which is quite cumbersome in regards to exporting for mobile :-/
Example from line 40 to 120 (px-settings and .svg-file):
var createCss = function () {
var css = [
'body {',
' background-color: #283538;',
'}',
'#application-splash-wrapper {',
' position: absolute;',
' top: 0;',
' left: 0;',
' height: 100%;',
' width: 100%;',
' background-image: radial-gradient(#102030, #000000 , #101020);',
'}',
'#application-splash {',
' position: absolute;',
' top: calc(50% - 270px);',
' width: 540px;',
' left: calc(50% - 270px);',
'}',
'#application-splash img {',
' width: 100%;',
'}',
'#progress-bar-container {',
' margin: 20px auto 0 auto;',
' height: 4px;',
' width: 100%;',
' background-image: linear-gradient(to left,#d0e3db, #f8f9e1 , #eef2c8);',
'}',
'#progress-bar {',
' width: 0%;',
' height: 100%;',
' background-color: #fff;',
'}',
'@media (max-width: 600px) {',
' #application-splash {',
' width: 270px;',
' left: calc(50% - 85px);',
' }',
'}'
].join("\n");
var style = document.createElement('style');
style.type = 'text/css';
if (style.styleSheet) {
style.styleSheet.cssText = css;
} else {
style.appendChild(document.createTextNode(css));
}
document.head.appendChild(style);
};
createCss();
showSplash();
// Use an image from the assets in the project via the asset registry
// More information: http://developer.playcanvas.com/en/api/pc.AssetRegistry.html
app.on('preload:start', function() {
var splash = document.getElementById('application-splash');
var logoAsset = app.assets.find('DesOn_Promo_SplashSVG4.svg');
if (logoAsset) {
var logo = document.createElement('img');
logo.src = logoAsset.getFileUrl();
// Insert DOM before the progress bar
if (splash.childNodes.length > 0) {
splash.insertBefore(logo, splash.childNodes[0]);
} else {
splash.appendChild(logo);
}
logo.onload = function () {
splash.style.display = 'block';
};
}
});
I have already tried many alternative standard CSS-methods