Skip to content

Commit

Permalink
adding utilization of background images and some improvements
Browse files Browse the repository at this point in the history
  • Loading branch information
kylebakerio authored Nov 2, 2022
1 parent dabead0 commit 87f1cd4
Showing 1 changed file with 30 additions and 23 deletions.
53 changes: 30 additions & 23 deletions random-config.html
Original file line number Diff line number Diff line change
Expand Up @@ -13,38 +13,40 @@
let loaderPresets = ["", null, "line", "rainbow", "energy", "stripe", "text", "filenames"];
let randomPreset = loaderPresets[Math.round(Math.random()*loaderPresets.length-1)]
let randomColor = () => [0,0,0,0,0,0].reduce((m,l) => m+Math.floor((Math.random() * 16)).toString(16).toUpperCase(),"#") // "#"+Math.floor(Math.random()*16777215).toString(16);
let randomBool = (n=1) => !!Math.round(Math.random()*n);

// here's a config object. everything is optional. almost all settings are shown here.
// while most of the obvious choices look pretty good, I didn't spend as much time perfecting it
// as I would have liked.
// as I would have liked. Contribs open to fix your preferred config.
let loaderOptions = {
debug:['log','warn','error'],
showLogoLoader: !!Math.round(Math.random()*1),
useGlitchEffect: !!Math.round(Math.random()*1),
showTitle: !!Math.round(Math.random()*1), //!!Math.round(Math.random()),
logoURL: randomLogo,
showLogoLoader: randomBool(),
logoFillColor: randomBool() ? randomColor() : "",
showTitle: randomBool(), //randomBool(),
logoURL: randomBool() ? randomLogo : "",
logoSize: [logoSize,logoSize],//"200,200",
useGlitchEffect: randomBool(),
font: "400 1.1rem/.1 Fira Sans,Helvetica,Arial,sans-serif",
// titleText: "A-LOAD-SCREEN (CTRL + SHIFT + R)",
hideSubtitle: false,
hideSubtitle: randomBool(),
// subtitleOverride: "",
titleFontStyle: `text-align:center;font-weight:${Math.floor(Math.random() * 10)*100};`, // don't specify font-size here, use titleFontSize
// titleFontSize: Math.random() * 100, // titleFontSize: see init for dynamic value setting; basically, if left unset, will be set to maximum font size to fit width of your image
showTextSpeedometer: !!Math.round(Math.random()),
fadeLoaderRows: !!Math.round(Math.random()),
showTextSpeedometer: randomBool(),
fadeLoaderRows: randomBool(),
autoReloadToHTTPS: true,
horizontalRulePercent: Math.random() * 100,
showGlobalStats: true,
showFileStats: true,
centeredLoadingBars: !!Math.round(Math.random()),
showVisualSpeedometer: !!Math.round(Math.random()),
showTimeElapsed:!!Math.round(Math.random()),
showGlobalStats: randomBool(),
showFileStats: randomBool(),
centeredLoadingBars: randomBool(),
showVisualSpeedometer: randomBool(),
showTimeElapsed:randomBool(),
// smoothLogoLoadFactor: 10, // megabyte; make value as big or small as you like, bigger is less jitter, low is more responsive load values; only matters for first file load, real value is cached in localstorage on first load
// number exists as placeholder assumed size for files before we have received that info from server if it isn't supplied in html; higher the value, lower the chance and intensity of jitter--higher the value, the more artificially held back your image load is; used to prevent flickering of load logo in beginning as new objects start loading on first load when sice not manually specified in html directly
showFileSizes: !!Math.round(Math.random()),
showBarLoaders: !!Math.round(Math.random()),
showFilenames: !!Math.round(Math.random()),
showDownloadTotals: !!Math.round(Math.random()),
showFileSizes: randomBool(),
showBarLoaders: randomBool(),
showFilenames: randomBool(),
showDownloadTotals: randomBool(),
barLoaderPreset: randomPreset, /// one of: "", null, line, rainbow, energy, stripe, text, filenames, | would require customization to work: fan, circle, bubble, | see https://loading.io/progress/ | also: https://github.com/loadingio/loading-bar/blob/af5271ef7c675783fe870b5a60d6057f32f73e47/src/presets.ls
customLogoLoaderAttributes: {
'data-fill':[`${randomColor()}`,`data:ldbar/res,gradient(45,2,${randomColor()},${randomColor()},${randomColor()})`][Math.floor(Math.random()*2)],
Expand All @@ -61,8 +63,14 @@
'data-fill-background': `${randomColor()}`,
}, // see usage of this object in this script to get a clearer idea, along with docs @ https://loading.io/progress
backgroundColor: randomColor(),
logoFillColor: randomColor(),
backgroundOpacity: Math.max(.4,Math.random()),
backgroundImage: randomBool(.75) ? randomLogo : "", //randomBool() ? randomLogo : "",
containerCSS: randomBool() ? "" : `
/* height: 500px; */ /* You must set a specified height */
background-position: center; /* Center the image */
background-repeat: no-repeat; /* Do not repeat the image */
background-size: cover; /* Resize the background image to cover the entire container */
`,
backgroundOpacity: randomBool() ? Math.max(.4,Math.random()) : "",
// styleOverrides: `
// .ldBar.label-center > .ldBar-label {
// display: none;
Expand Down Expand Up @@ -99,7 +107,6 @@
<a-camera wasd-controls></a-camera>
<a-assets>
<!-- broken link to force an error and show how error handling works -->
<a-asset-item id="space-break" src="https://cdn.glitch.global/4912face-eb4d-4b46-a196-56ed20bce8b6/need_some_space-badlink.glb?v=1663844941833" filesize="7000000"></a-asset-item>

<!-- lots of random models with CC from sketchfab so the load takes a while -->
<a-asset-item id="nakna" src="https://cdn.glitch.me/4912face-eb4d-4b46-a196-56ed20bce8b6/nakna_gallery.glb?v=1663837524202" filesize="22543324"></a-asset-item>
Expand All @@ -109,6 +116,7 @@
<a-asset-item id="swan" src="https://cdn.glitch.global/4912face-eb4d-4b46-a196-56ed20bce8b6/nude_woman_with_swan_statue.glb?v=1663843165629" filesize="3041292"></a-asset-item>
<a-asset-item id="resting" src="https://cdn.glitch.global/4912face-eb4d-4b46-a196-56ed20bce8b6/resting_nude__1923.glb?v=1663843210918" filesize="1456352"></a-asset-item>
<a-asset-item id="basement" src="https://cdn.glitch.global/4912face-eb4d-4b46-a196-56ed20bce8b6/ricks_basement.glb?v=1663843212347" filesize="1748096"></a-asset-item>
<a-asset-item id="example-broken-link" src="https://cdn.glitch.global/4912face-eb4d-4b46-a196-56ed20bce8b6/need_some_space-badlink.glb?v=1663844941833" filesize="7000000"></a-asset-item>
<a-asset-item id="psych" src="https://cdn.glitch.me/4912face-eb4d-4b46-a196-56ed20bce8b6/the_vr_gallery_shows__vr_cyberdelics.glb?v=1663843242951" filesize="21808288"></a-asset-item>
<a-asset-item id="space" src="https://cdn.glitch.global/4912face-eb4d-4b46-a196-56ed20bce8b6/need_some_space.glb?v=1663844941833" filesize="1401564"></a-asset-item>
<a-asset-item id="porsche" src="https://cdn.glitch.me/4912face-eb4d-4b46-a196-56ed20bce8b6/free_1975_porsche_911_930_turbo.glb?v=1663845074654" filesize="21969080"></a-asset-item>
Expand Down Expand Up @@ -156,7 +164,7 @@


<!-- github octo-cat overlay -->
<a href="https://github.com/kylebakerio/a-load-screen" class="github-corner" aria-label="View source on GitHub"><svg width="80" height="80" viewBox="0 0 250 250" style="z-index: 2; fill:#151513; color:#fff; position: absolute; top: 0; border: 0; right: 0;" aria-hidden="true"><path d="M0,0 L115,115 L130,115 L142,142 L250,250 L250,0 Z"></path><path d="M128.3,109.0 C113.8,99.7 119.0,89.6 119.0,89.6 C122.0,82.7 120.5,78.6 120.5,78.6 C119.2,72.0 123.4,76.3 123.4,76.3 C127.3,80.9 125.5,87.3 125.5,87.3 C122.9,97.6 130.6,101.9 134.4,103.2" fill="currentColor" style="transform-origin: 130px 106px;" class="octo-arm"></path><path d="M115.0,115.0 C114.9,115.1 118.7,116.5 119.8,115.4 L133.7,101.6 C136.9,99.2 139.9,98.4 142.2,98.6 C133.8,88.0 127.5,74.4 143.8,58.0 C148.5,53.4 154.0,51.2 159.7,51.0 C160.3,49.4 163.2,43.6 171.4,40.1 C171.4,40.1 176.1,42.5 178.8,56.2 C183.1,58.6 187.2,61.8 190.9,65.4 C194.5,69.0 197.7,73.2 200.1,77.6 C213.8,80.2 216.3,84.9 216.3,84.9 C212.7,93.1 206.9,96.0 205.4,96.6 C205.1,102.4 203.0,107.8 198.3,112.5 C181.9,128.9 168.3,122.5 157.7,114.1 C157.9,116.9 156.7,120.9 152.7,124.9 L141.0,136.5 C139.8,137.7 141.6,141.9 141.8,141.8 Z" fill="currentColor" class="octo-body"></path></svg></a><style>.github-corner:hover .octo-arm{animation:octocat-wave 560ms ease-in-out}@keyframes octocat-wave{0%,100%{transform:rotate(0)}20%,60%{transform:rotate(-25deg)}40%,80%{transform:rotate(10deg)}}@media (max-width:500px){.github-corner:hover .octo-arm{animation:none}.github-corner .octo-arm{animation:octocat-wave 560ms ease-in-out}}</style>
<a href="https://github.com/kylebakerio/a-load-screen" class="github-corner" aria-label="View source on GitHub"><svg width="80" height="80" viewBox="0 0 250 250" style="z-index: 10000; fill:#151513; color:#fff; position: absolute; top: 0; border: 0; right: 0;" aria-hidden="true"><path d="M0,0 L115,115 L130,115 L142,142 L250,250 L250,0 Z"></path><path d="M128.3,109.0 C113.8,99.7 119.0,89.6 119.0,89.6 C122.0,82.7 120.5,78.6 120.5,78.6 C119.2,72.0 123.4,76.3 123.4,76.3 C127.3,80.9 125.5,87.3 125.5,87.3 C122.9,97.6 130.6,101.9 134.4,103.2" fill="currentColor" style="transform-origin: 130px 106px;" class="octo-arm"></path><path d="M115.0,115.0 C114.9,115.1 118.7,116.5 119.8,115.4 L133.7,101.6 C136.9,99.2 139.9,98.4 142.2,98.6 C133.8,88.0 127.5,74.4 143.8,58.0 C148.5,53.4 154.0,51.2 159.7,51.0 C160.3,49.4 163.2,43.6 171.4,40.1 C171.4,40.1 176.1,42.5 178.8,56.2 C183.1,58.6 187.2,61.8 190.9,65.4 C194.5,69.0 197.7,73.2 200.1,77.6 C213.8,80.2 216.3,84.9 216.3,84.9 C212.7,93.1 206.9,96.0 205.4,96.6 C205.1,102.4 203.0,107.8 198.3,112.5 C181.9,128.9 168.3,122.5 157.7,114.1 C157.9,116.9 156.7,120.9 152.7,124.9 L141.0,136.5 C139.8,137.7 141.6,141.9 141.8,141.8 Z" fill="currentColor" class="octo-body"></path></svg></a><style>.github-corner:hover .octo-arm{animation:octocat-wave 560ms ease-in-out}@keyframes octocat-wave{0%,100%{transform:rotate(0)}20%,60%{transform:rotate(-25deg)}40%,80%{transform:rotate(10deg)}}@media (max-width:500px){.github-corner:hover .octo-arm{animation:none}.github-corner .octo-arm{animation:octocat-wave 560ms ease-in-out}}</style>

<!-- REMIX BUTTON -->
<style>
Expand Down Expand Up @@ -242,7 +250,6 @@
</a>
</footer>
<!-- /REMIX BUTTON -->



<script>
Expand Down Expand Up @@ -274,4 +281,4 @@
}
})
</script>
</html>
</html>

0 comments on commit 87f1cd4

Please sign in to comment.