added modelviewer and css

This commit is contained in:
Luca Junge 2022-11-13 20:56:17 +01:00
parent 1326d54083
commit ad7d092728
5 changed files with 113 additions and 144 deletions

View file

@ -8,15 +8,9 @@
<title>{{ title }}</title> <title>{{ title }}</title>
</head> </head>
<body> <body>
<main> <model-viewer src="{{file if file else 'model.glb'}}" field-of-view="{{fieldofview if fieldofview else 'auto'}}" ar xr-environment camera-controls shadow-intensity=1>
<model-viewer src="{{file}}" ar camera-controls shadow-intensity=1><button class="Hotspot" slot="hotspot-3" data-position="0.034086908507172255m 0.035633058045035026m 0.0008323315838707837m" data-normal="0.11076220205426575m 0.9733893287613071m 0.2006114384817127m" data-visibility-attribute="visible"> {{content | safe}}
<div class="HotspotAnnotation">The Beak</div> </model-viewer>
</button><button class="Hotspot" slot="hotspot-4" data-position="-0.0077982119614389955m -0.008128374324366697m -0.034137767670381604m" data-normal="-0.2165819895695754m 0.2073173991125989m -0.9539977661500428m" data-visibility-attribute="visible">
<div class="HotspotAnnotation">A Wing</div>
</button><button class="Hotspot" slot="hotspot-5" data-position="-0.04329843722003483m 0.011786457618276569m 0.0029983665888340706m" data-normal="-0.7752145503176167m 0.6212154023517756m 0.11460290073456728m" data-visibility-attribute="visible">
<div class="HotspotAnnotation">The Tail</div>
</button></model-viewer>
</main>
<script type="module" src="/assets/model-viewer.min.js"></script> <script type="module" src="/assets/model-viewer.min.js"></script>
</body> </body>
</html> </html>

View file

@ -1,176 +1,142 @@
html,
body { body {
margin: 0; margin: 0;
padding: 0; padding: 0;
overflow: hidden; width: 100vw;
height: 100%; height: 100vh;
} }
model-viewer { model-viewer {
height: 100vh; width: 100%;
width: 100% height: 90%;
background-color: #ffffff;
} }
:not(:defined)>* { :not(:defined) > * {
display: none; display: none;
} }
.Hotspot { .Hotspot {
background: #fff; background: #fff;
border-radius: 32px; border-radius: 32px;
border: 0; border: 0;
box-shadow: 0 2px 4px rgba(0, 0, 0, 0.25); box-shadow: 0 2px 4px rgba(0, 0, 0, 0.25);
box-sizing: border-box; box-sizing: border-box;
cursor: pointer; cursor: pointer;
height: 24px; height: 24px;
padding: 8px; padding: 8px;
position: relative; position: relative;
transition: opacity 0.3s; transition: opacity 0.3s;
width: 24px; width: 24px;
} }
.Hotspot:not([data-visible]) { .Hotspot:not([data-visible]) {
background: transparent; background: transparent;
border: 4px solid #fff; border: 4px solid #fff;
box-shadow: none; box-shadow: none;
height: 32px; height: 32px;
pointer-events: none; pointer-events: none;
width: 32px; width: 32px;
} }
.Hotspot:focus { .Hotspot:focus {
border: 4px solid rgb(0, 128, 200); border: 4px solid rgb(0, 128, 200);
height: 32px; height: 32px;
outline: none; outline: none;
width: 32px; width: 32px;
} }
.Hotspot>* { .Hotspot > * {
opacity: 1; opacity: 1;
transform: translateY(-50%); transform: translateY(-50%);
} }
.HotspotAnnotation { .HotspotAnnotation {
background: #fff; background: #fff;
border-radius: 4px; border-radius: 4px;
box-shadow: 0 2px 4px rgba(0, 0, 0, 0.25); box-shadow: 0 2px 4px rgba(0, 0, 0, 0.25);
color: rgba(0, 0, 0, 0.8); color: rgba(0, 0, 0, 0.8);
display: block; display: block;
font-family: Futura, Helvetica Neue, sans-serif; font-family: Futura, Helvetica Neue, sans-serif;
font-size: 18px; font-size: 18px;
font-weight: 700; font-weight: 700;
left: calc(100% + 1em); left: calc(100% + 1em);
max-width: 128px; max-width: 128px;
overflow-wrap: break-word; overflow-wrap: break-word;
padding: 0.5em 1em; padding: 0.5em 1em;
position: absolute; position: absolute;
top: 50%; top: 50%;
width: max-content; width: max-content;
} }
.Hotspot:not([data-visible])>* { .Hotspot:not([data-visible]) > * {
opacity: 0; opacity: 0;
pointer-events: none; pointer-events: none;
transform: translateY(calc(-50% + 4px)); transform: translateY(calc(-50% + 4px));
transition: transform 0.3s, opacity 0.3s; transition: transform 0.3s, opacity 0.3s;
} }
.progress-bar { .progress-bar {
display: block; display: block;
width: 33%; width: 33%;
height: 10%; height: 10%;
max-height: 2%; max-height: 2%;
position: absolute; position: absolute;
left: 50%; left: 50%;
top: 50%; top: 50%;
transform: translate3d(-50%, -50%, 0); transform: translate3d(-50%, -50%, 0);
border-radius: 25px; 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); box-shadow: 0px 3px 10px 3px rgba(0, 0, 0, 0.5),
border: 1px solid rgba(255, 255, 255, 0.9); 0px 0px 5px 1px rgba(0, 0, 0, 0.6);
background-color: rgba(0, 0, 0, 0.5); border: 1px solid rgba(255, 255, 255, 0.9);
background-color: rgba(0, 0, 0, 0.5);
} }
.progress-bar.hide { .progress-bar.hide {
visibility: hidden; visibility: hidden;
transition: visibility 0.3s; transition: visibility 0.3s;
} }
.update-bar { .update-bar {
background-color: rgba(255, 255, 255, 0.9); background-color: rgba(255, 255, 255, 0.9);
width: 0%; width: 0%;
height: 100%; height: 100%;
border-radius: 25px; border-radius: 25px;
float: left; float: left;
transition: width 0.3s; 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 { @keyframes circle {
from { from {
transform: translateX(-50%) rotate(0deg) translateX(50px) rotate(0deg); transform: translateX(-50%) rotate(0deg) translateX(50px) rotate(0deg);
} }
to { to {
transform: translateX(-50%) rotate(360deg) translateX(50px) rotate(-360deg); transform: translateX(-50%) rotate(360deg) translateX(50px) rotate(-360deg);
} }
} }
@keyframes elongate { @keyframes elongate {
from { from {
transform: translateX(100px); transform: translateX(100px);
} }
to { to {
transform: translateX(-100px); transform: translateX(-100px);
} }
} }
model-viewer>#ar-prompt { model-viewer > #ar-prompt {
position: absolute; position: absolute;
left: 50%; left: 50%;
bottom: 60px; bottom: 60px;
animation: elongate 2s infinite ease-in-out alternate; animation: elongate 2s infinite ease-in-out alternate;
display: none; display: none;
} }
model-viewer[ar-status="session-started"]>#ar-prompt { model-viewer[ar-status="session-started"] > #ar-prompt {
display: block; display: block;
} }
model-viewer>#ar-prompt>img { model-viewer > #ar-prompt > img {
animation: circle 4s linear infinite; animation: circle 4s linear infinite;
} }

View file

@ -0,0 +1,5 @@
---
title: Stadttheater Bremerhaven
alt: Ein 3D-Modell des Stadttheaters in Bremerhaven
fieldofview: 45deg
---

Binary file not shown.

View file

@ -6,8 +6,12 @@ file: model.glb
<button class="Hotspot" slot="hotspot-3" data-position="0.034086908507172255m 0.035633058045035026m 0.0008323315838707837m" data-normal="0.11076220205426575m 0.9733893287613071m 0.2006114384817127m" data-visibility-attribute="visible"> <button class="Hotspot" slot="hotspot-3" data-position="0.034086908507172255m 0.035633058045035026m 0.0008323315838707837m" data-normal="0.11076220205426575m 0.9733893287613071m 0.2006114384817127m" data-visibility-attribute="visible">
<div class="HotspotAnnotation">The Beak</div> <div class="HotspotAnnotation">The Beak</div>
</button><button class="Hotspot" slot="hotspot-4" data-position="-0.0077982119614389955m -0.008128374324366697m -0.034137767670381604m" data-normal="-0.2165819895695754m 0.2073173991125989m -0.9539977661500428m" data-visibility-attribute="visible"> </button>
<button class="Hotspot" slot="hotspot-4" data-position="-0.0077982119614389955m -0.008128374324366697m -0.034137767670381604m" data-normal="-0.2165819895695754m 0.2073173991125989m -0.9539977661500428m" data-visibility-attribute="visible">
<div class="HotspotAnnotation">A Wing</div> <div class="HotspotAnnotation">A Wing</div>
</button><button class="Hotspot" slot="hotspot-5" data-position="-0.04329843722003483m 0.011786457618276569m 0.0029983665888340706m" data-normal="-0.7752145503176167m 0.6212154023517756m 0.11460290073456728m" data-visibility-attribute="visible"> </button>
<div class="HotspotAnnotation">The Tail</div>
</button> <button class="Hotspot" slot="hotspot-5" data-position="-0.04329843722003483m 0.011786457618276569m 0.0029983665888340706m" data-normal="-0.7752145503176167m 0.6212154023517756m 0.11460290073456728m" data-visibility-attribute="visible">
<div class="HotspotAnnotation">The Tail</div>
</button>