Skip to content
This repository has been archived by the owner on Oct 6, 2024. It is now read-only.

Commit

Permalink
Add a globe to the homepage which kicks ASS
Browse files Browse the repository at this point in the history
  • Loading branch information
larsenv committed Oct 3, 2023
1 parent e1eca16 commit 184eda1
Show file tree
Hide file tree
Showing 8 changed files with 151 additions and 2 deletions.
Binary file added images/globe/ar_hand_prompt.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/globe/ar_icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/globe/earth.gltf
Binary file not shown.
Binary file added images/globe/poster.webp
Binary file not shown.
13 changes: 13 additions & 0 deletions images/globe/script.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
// Handles loading the events for <model-viewer>'s slotted progress bar
const onProgress = (event) => {
const progressBar = event.target.querySelector('.progress-bar');
const updatingBar = event.target.querySelector('.update-bar');
updatingBar.style.width = `${event.detail.totalProgress * 100}%`;
if (event.detail.totalProgress === 1) {
progressBar.classList.add('hide');
event.target.removeEventListener('progress', onProgress);
} else {
progressBar.classList.remove('hide');
}
};
document.querySelector('model-viewer').addEventListener('progress', onProgress);
11 changes: 11 additions & 0 deletions images/globe/snippet.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<model-viewer src="earth.gltf" ar ar-modes="webxr scene-viewer quick-look" camera-controls poster="poster.webp" shadow-intensity="1" exposure="0.5" camera-orbit="-458.1deg 66.27deg 0.1432m" field-of-view="30deg" auto-rotate>
<div class="progress-bar hide" slot="progress-bar">
<div class="update-bar"></div>
</div>
<button slot="ar-button" id="ar-button">
View in your space
</button>
<div id="ar-prompt">
<img src="https://modelviewer.dev/shared-assets/icons/hand.png">
</div>
</model-viewer>
109 changes: 109 additions & 0 deletions images/globe/styles.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,109 @@
:not(:defined) > * {
display: none;
}

html {
height: 100%;
}

body {
margin: 0;
padding: 0;
width: 100%;
height: 100%;
}

model-viewer {
width: 100%;
height: 90%;
background-color: #ffffff;
}


.progress-bar {
display: block;
width: 33%;
height: 10%;
max-height: 2%;
position: absolute;
left: 50%;
top: 50%;
transform: translate3d(-50%, -50%, 0);
border-radius: 25px;
box-shadow: 0px 3px 10px 3px rgba(0, 0, 0, 0.5), 0px 0px 5px 1px rgba(0, 0, 0, 0.6);
border: 1px solid rgba(255, 255, 255, 0.9);
background-color: rgba(0, 0, 0, 0.5);
}

.progress-bar.hide {
visibility: hidden;
transition: visibility 0.3s;
}

.update-bar {
background-color: rgba(255, 255, 255, 0.9);
width: 0%;
height: 100%;
border-radius: 25px;
float: left;
transition: width 0.3s;
}

#ar-button {
background-image: url(ar_icon.png);
background-repeat: no-repeat;
background-size: 20px 20px;
background-position: 12px 50%;
background-color: #fff;
position: absolute;
left: 50%;
transform: translateX(-50%);
white-space: nowrap;
bottom: 16px;
padding: 0px 16px 0px 40px;
font-family: Roboto Regular, Helvetica Neue, sans-serif;
font-size: 14px;
color:#4285f4;
height: 36px;
line-height: 36px;
border-radius: 18px;
border: 1px solid #DADCE0;
}

#ar-button:active {
background-color: #E8EAED;
}

#ar-button:focus {
outline: none;
}

#ar-button:focus-visible {
outline: 1px solid #4285f4;
}

@keyframes circle {
from { transform: translateX(-50%) rotate(0deg) translateX(50px) rotate(0deg); }
to { transform: translateX(-50%) rotate(360deg) translateX(50px) rotate(-360deg); }
}

@keyframes elongate {
from { transform: translateX(100px); }
to { transform: translateX(-100px); }
}

model-viewer > #ar-prompt {
position: absolute;
left: 50%;
bottom: 60px;
animation: elongate 2s infinite ease-in-out alternate;
display: none;
}

model-viewer[ar-status="session-started"] > #ar-prompt {
display: block;
}

model-viewer > #ar-prompt > img {
animation: circle 4s linear infinite;
}
20 changes: 18 additions & 2 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,24 @@ <h5 class="header col s12 light white-text center">RiiConnect24 brings back WiiC

<div class="container">
<div class="section center">
<script src="/js/cat.js"></script>
<img src="/images/helpcat.svg" width="300" alt="Click Me!" onclick="catClicked()" />
<div class="row">
<div class="col s6">
<model-viewer src="/images/globe/earth.gltf" style="width: 500px; height: 500px;" alt="Globe" ar
ar-modes="webxr scene-viewer quick-look" camera-controls poster="/images/globe/poster.webp"
shadow-intensity="0" exposure="0.5" camera-orbit="-108.9deg 66deg 0.1432m" field-of-view="30deg" auto-rotate>
<div class="progress-bar hide" slot="progress-bar">
<div class="update-bar"></div>
</div>
</model-viewer>
</div>
<div class="col s6">
<script src="/images/globe/script.js"></script>
<script src="/js/cat.js"></script>
<script type="module"
src="https://ajax.googleapis.com/ajax/libs/model-viewer/3.2.0/model-viewer.min.js"></script>
<img src="/images/helpcat.svg" width="500" alt="Click Me!" onclick="catClicked()" />
</div>
</div>
<h3 class="header center white-text"><i class="fas fa-cogs" aria-hidden="true"></i> Services</h3>

<p class="light center">Here are the services that RiiConnect24 supports.</p>
Expand Down

0 comments on commit 184eda1

Please sign in to comment.