Files
yoyos.sh/src/pages/models.astro
T
Johan Sandoval 38b5213138
Mirror to Gitea / mirror (push) Skipped
Replace Openverse images, fix blank space and spacing on mobile
- Swap every photo for Unsplash photos and Pixabay stickers/clipart,
  credited in IMAGE_CREDITS.md and /credits; regenerate effect images
- Reveal animations never hide on-screen content and have a failsafe, so
  sections can no longer stay blank on phones
- Tighter section and footer spacing on mobile; drop the unlabeled status
  dot on mobile and the blog's fake loading bar
- Cover moves from the all-green poster to the board's mixed palette
- New boombox, spray can and headphones stickers
2026-10-08 19:08:34 +00:00

371 lines
9.6 KiB
Plaintext

---
import { getCollection } from 'astro:content';
import { Image } from 'astro:assets';
import Base from '../layouts/Base.astro';
import ModelViewer from '../components/ModelViewer.astro';
import FaultyTerminal from '../components/bits/FaultyTerminal';
import { media } from '../lib/media';
import cloud from '../assets/photos/cloud.webp';
import hibiscus from '../assets/fx/hibiscus-toon.webp';
import lily from '../assets/fx/lily-pixel.webp';
import FxImage from '../components/FxImage.astro';
const models = (await getCollection('models')).sort((a, b) => +b.data.date - +a.data.date);
const faces = ['front', 'back', 'left', 'right', 'top', 'bottom'];
const readout = [
['MESH', 'quad-dominant'],
['UV', 'unwrapped / packed'],
['MAT', 'PBR metal-rough'],
['EXPORT', 'glTF 2.0 binary'],
['COMP', 'Draco'],
['VIEW', 'WebGL / three.js'],
];
---
<Base title="3D Models" description="3D models by Johan Sandoval, viewable in the browser." theme="vector">
<section class="hero">
<div class="term" aria-hidden="true">
<FaultyTerminal
client:only="react"
tint="#ff9a2a"
scale={1.6}
digitSize={1.3}
gridMul={[2, 1]}
timeScale={0.35}
scanlineIntensity={0.4}
glitchAmount={0.8}
flickerAmount={0.6}
curvature={0.15}
brightness={0.55}
mouseReact={false}
dpr={1}
/>
</div>
<div class="wrap intro">
<p class="sys">Blender · glTF · real-time in the browser</p>
<h1 class="glow glitch" data-text="3D Models">3D Models</h1>
<p class="sub">Models I've built in Blender. Drag to rotate, pinch or scroll to zoom.</p>
</div>
</section>
<section class="wrap section specimen">
<div class="stage" aria-hidden="true">
<div class="cube">
{faces.map((f) => <span class={`face ${f}`} />)}
</div>
<Image class="cloud" src={cloud} alt="" widths={[360, 640]} sizes="60vw" />
<div class="floor"></div>
</div>
<div class="spec-copy" data-reveal>
<p class="sys">Pipeline</p>
<h2>From Blender to your browser</h2>
<p class="muted">
Everything here is modeled in Blender, exported as compressed glTF and rendered live with
three.js, so you can inspect it from any angle on your phone.
</p>
</div>
</section>
<section class="wrap section flower" aria-hidden="true">
<div class="col left">
{readout.slice(0, 3).map(([k, v]) => <p><b>{k}</b> {v}</p>)}
<p class="blocks">▚▞▚▞▚▞▚▞▚▞</p>
</div>
<div class="petal">
<FxImage src={hibiscus} mode="crt" amount={1} ratio="3 / 2" sizes="(min-width: 52rem) 40vw, 90vw" />
<span class="tag tl">OBJ_001</span>
<span class="tag br">RENDER OK</span>
</div>
<div class="col right">
{readout.slice(3).map(([k, v]) => <p><b>{k}</b> {v}</p>)}
<p class="blocks">▞▚▞▚▞▚▞▚▞▚</p>
<Image class="lily" src={lily} alt="" format="png" />
</div>
</section>
<section class="wrap section">
<div class="grid" data-reveal data-reveal-stagger>
{
models.map((m, i) => (
<figure class="item">
<ModelViewer src={media(m.data.file)} poster={m.data.poster && media(m.data.poster)} alt={m.data.title} ratio="1 / 1" />
<figcaption>
<div class="row">
<h2>{m.data.title}</h2>
<span class="idx">#{String(i + 1).padStart(3, '0')}</span>
</div>
<dl class="readout">
<dt>Date</dt>
<dd>{m.data.date.toISOString().slice(0, 10)}</dd>
{m.data.tools.length > 0 && (
<>
<dt>Tools</dt>
<dd>{m.data.tools.join(' · ')}</dd>
</>
)}
</dl>
{m.data.notes && <p class="notes">{m.data.notes}</p>}
</figcaption>
</figure>
))
}
</div>
</section>
</Base>
<style>
.hero {
position: relative;
overflow: hidden;
min-height: clamp(22rem, 92vw, 32rem);
display: grid;
align-items: end;
border-bottom: 1px solid var(--line-strong);
background: #000;
}
.term {
position: absolute;
inset: 0;
opacity: 0.85;
}
.term::after {
content: '';
position: absolute;
inset: 0;
background: linear-gradient(to top, #050507 8%, transparent 70%);
}
.intro {
position: relative;
padding-block: var(--space-8) var(--space-6);
}
.sys {
font-family: var(--ff-crt);
font-size: 1.3rem;
color: var(--signal);
}
h1 {
font-size: clamp(4rem, 19vw, 12rem);
line-height: 0.85;
color: var(--accent);
}
.sub {
max-width: 44ch;
color: var(--fg);
}
/* cloud in a wireframe box */
.specimen {
overflow: clip;
display: grid;
gap: var(--space-6);
align-items: center;
}
.stage {
position: relative;
height: clamp(18rem, 80vw, 26rem);
perspective: 900px;
display: grid;
place-items: center;
}
.cube {
--s: clamp(11rem, 52vw, 16rem);
position: absolute;
width: var(--s);
height: var(--s);
transform-style: preserve-3d;
animation: spin 24s linear infinite;
}
.face {
position: absolute;
inset: 0;
border: 1px solid var(--cyan);
background:
linear-gradient(color-mix(in oklab, var(--cyan) 22%, transparent) 1px, transparent 1px) 0 0 / 25% 25%,
linear-gradient(90deg, color-mix(in oklab, var(--cyan) 22%, transparent) 1px, transparent 1px) 0 0 / 25% 25%;
box-shadow: 0 0 12px color-mix(in oklab, var(--cyan) 30%, transparent);
}
.front {
transform: translateZ(calc(var(--s) / 2));
}
.back {
transform: rotateY(180deg) translateZ(calc(var(--s) / 2));
}
.left {
transform: rotateY(-90deg) translateZ(calc(var(--s) / 2));
}
.right {
transform: rotateY(90deg) translateZ(calc(var(--s) / 2));
}
.top {
transform: rotateX(90deg) translateZ(calc(var(--s) / 2));
}
.bottom {
transform: rotateX(-90deg) translateZ(calc(var(--s) / 2));
}
@keyframes spin {
from {
transform: rotateX(-18deg) rotateY(0deg);
}
to {
transform: rotateX(-18deg) rotateY(360deg);
}
}
.stage :global(.cloud) {
position: relative;
width: clamp(9rem, 44vw, 14rem);
height: auto;
filter: grayscale(1) contrast(1.6) brightness(1.1);
mix-blend-mode: screen;
-webkit-mask: radial-gradient(closest-side, #000 55%, transparent);
mask: radial-gradient(closest-side, #000 55%, transparent);
animation: bob 6s ease-in-out infinite;
}
@keyframes bob {
50% {
translate: 0 -10px;
}
}
.floor {
position: absolute;
bottom: 0;
left: -20%;
right: -20%;
height: 45%;
background:
linear-gradient(var(--amber) 1px, transparent 1px) 0 0 / 40px 40px,
linear-gradient(90deg, var(--amber) 1px, transparent 1px) 0 0 / 40px 40px;
transform: perspective(300px) rotateX(70deg);
transform-origin: bottom;
opacity: 0.35;
mask: linear-gradient(to top, #000, transparent);
}
.spec-copy h2 {
font-size: clamp(2.2rem, 9vw, 3.5rem);
color: var(--fg);
margin-block: var(--space-2) var(--space-3);
}
@media (min-width: 52rem) {
.specimen {
grid-template-columns: 1fr 1fr;
}
}
/* hibiscus with data columns */
.flower {
display: grid;
grid-template-columns: 1fr;
gap: var(--space-4);
font-family: var(--ff-crt);
font-size: 1.2rem;
color: var(--accent);
}
.flower b {
color: var(--signal);
font-weight: 400;
}
.col {
display: grid;
grid-template-columns: 1fr 1fr 1fr;
gap: var(--space-2);
}
.col p {
line-height: 1.1;
}
.blocks {
display: none;
}
.petal {
position: relative;
border: 1px solid var(--line-strong);
padding: 6px;
}
.flower :global(.lily) {
display: none;
width: 100%;
image-rendering: pixelated;
border: 1px solid var(--line-strong);
}
@media (min-width: 52rem) {
.flower :global(.lily) {
display: block;
}
}
.petal .tag {
position: absolute;
padding: 0.1rem 0.4rem;
background: #000;
border-color: var(--cyan);
color: var(--cyan);
font-family: var(--ff-crt);
font-size: 1rem;
}
.tl {
top: -0.8rem;
left: 0.6rem;
}
.br {
bottom: -0.8rem;
right: 0.6rem;
}
@media (min-width: 52rem) {
.flower {
grid-template-columns: 12rem 1fr 12rem;
align-items: center;
}
.col {
grid-template-columns: 1fr;
gap: var(--space-4);
}
.blocks {
display: block;
color: var(--line-strong);
}
.right {
text-align: right;
}
}
.grid {
display: grid;
grid-template-columns: repeat(auto-fill, minmax(min(100%, 22rem), 1fr));
gap: var(--space-7);
}
.item {
display: grid;
gap: var(--space-4);
}
.item :global(.viewer) {
margin-bottom: 0;
border-color: var(--cyan);
background:
linear-gradient(color-mix(in oklab, var(--cyan) 14%, transparent) 1px, transparent 1px) 0 0 / 24px 24px,
linear-gradient(90deg, color-mix(in oklab, var(--cyan) 14%, transparent) 1px, transparent 1px) 0 0 / 24px 24px,
#000;
}
.row {
display: flex;
justify-content: space-between;
align-items: baseline;
gap: var(--space-3);
}
.item h2 {
font-size: var(--step-3);
color: var(--fg);
}
.idx {
font-family: var(--ff-crt);
font-size: 1.3rem;
color: var(--signal);
}
.readout {
margin-block: var(--space-2);
}
.readout dd {
color: var(--accent);
}
.notes {
color: var(--fg-muted);
font-size: 0.95rem;
}
</style>