Use real public-domain photos throughout (Chicago skyline, CTA signage, Marina City, Union Station, guitars, synths, cassette, Game Boy and floppy stickers, daisies, clouds, flowers, a vintage postcard and stamp), credited on a new /credits page. Lean into Chicago: CTA 'L' line colors for sections and categories, a Chicago star logo, flag footer, a CTA platform work page with split-flap board and arrival rows, and a Greetings from Chicago postcard on contact. Add GSAP + Lenis scroll motion and React Bits components (split-flap, ticker, circular badge, count-up, sticker peel, scrambled text, halftone reveal, CRT terminal, staggered mobile menu). Rebuild pages mobile-first, drop the katakana, and lazy-load the 3D viewer.
No files matched your search
@@ -36,29 +36,44 @@ Every field is typed in `src/content.config.ts`, so the build fails loudly when
|
|||||||
|
|
||||||
## Styling
|
## Styling
|
||||||
|
|
||||||
Each page has its own look, built on one shared palette and a "subway line" color system
|
Each page has its own look, drawn from 80s–90s print and retro-tech references, tied together by
|
||||||
(every section and project category has a line color + badge, see `src/lib/disciplines.ts`).
|
Chicago: every section and project category rides a CTA 'L' line color (`src/lib/disciplines.ts`,
|
||||||
|
`--cta-*` tokens), and the footer carries the Chicago flag.
|
||||||
|
|
||||||
| Theme | Used on | Feel |
|
| Theme | Used on | Feel |
|
||||||
|---|---|---|
|
|---|---|---|
|
||||||
| `magazine` (default) | Home | 90s magazine cover / print ad |
|
| `magazine` (default) | Home | Maximalist magazine cover: photo collage, stickers, cover lines |
|
||||||
| `transit` | Work index | Subway map, transit cards |
|
| `transit` | Work index | CTA platform: station sign, split-flap board, arrival rows |
|
||||||
| `spec` | Project pages | Technical exhibition poster |
|
| `spec` | Project pages, credits | Technical exhibition poster |
|
||||||
| `desktop` | Blog, 404 | Late-90s desktop windows |
|
| `desktop` | Blog, 404 | 90s desktop windows, pixelated photo wallpaper |
|
||||||
| `radio` | Music | College-radio flyer, dot-matrix type |
|
| `radio` | Music | Radio flyer, halftone photo, dot-matrix type |
|
||||||
| `vector` | 3D models | 80s computer graphics, wireframes |
|
| `vector` | 3D models | CRT terminal, wireframe cube, data panels |
|
||||||
| `garden` | About | Grass, cream blobs, lowercase type |
|
| `garden` | About | Daisies, cream blobs, seed packets |
|
||||||
| `postcard` | Contact | Postcard + stamp |
|
| `postcard` | Contact | "Greetings from Chicago" postcard + stamp |
|
||||||
| `terminal` | (available) | Green-phosphor CRT |
|
| `terminal` | (available) | Green-phosphor CRT |
|
||||||
|
|
||||||
- `src/styles/tokens.css`: raw palette (paper, ink, lime, red, cobalt, yellow, emerald...), font stacks, type scale, spacing.
|
- Tokens: `src/styles/tokens.css`. Themes: `src/styles/themes/*.css` (semantic tokens only).
|
||||||
- `src/styles/themes/*.css`: each theme maps the palette onto semantic tokens (`--bg`, `--fg`, `--accent`,
|
- Pick a theme: `<Base theme="radio">`, or `theme: vector` in a project/post's frontmatter.
|
||||||
`--font-display`, heading weight/case/width, border, shadow, grain, scanlines).
|
- Mixed media: `src/components/deco/` — `Clipping` (real photo with tape / tilt / duotone / riso /
|
||||||
- Use a theme on a page: `<Base theme="radio">`, or `theme: vector` in a project/post's frontmatter
|
halftone / torn edge), `Starburst`, `Barcode`, `Window`, `Stamp`; plus `ChicagoStar`, `LineBadge`.
|
||||||
(projects default to `spec`, posts to `desktop`). Use it on one section: `<section data-theme="garden">`.
|
- Photos: `src/assets/photos/` — all CC0 / public domain via Openverse, listed in
|
||||||
- New theme: copy a theme file, rename the selector, import it in `themes/index.css`, add the name to `src/lib/themes.ts`.
|
`src/data/photo-credits.json` and shown at `/credits`. Add new ones there too.
|
||||||
- Page-specific flourishes live in each page's own `<style>` block (scoped automatically).
|
|
||||||
- Decorative components: `src/components/deco/` (Starburst, Barcode, Window, Stamp) and `LineBadge`.
|
### Motion
|
||||||
|
|
||||||
|
- **Lenis** smooth scrolling + **GSAP** ScrollTrigger in `src/scripts/motion.ts`. Mark elements with
|
||||||
|
`data-reveal` (or `data-reveal="tilt"`), `data-reveal-stagger` on a parent, `data-parallax="0.2"`.
|
||||||
|
Touch devices keep native scrolling; everything is skipped for `prefers-reduced-motion`.
|
||||||
|
- **React Bits** components live in `src/components/bits/` (copied source, MIT + Commons Clause —
|
||||||
|
keep the header notice): SplitFlapText, ScrollVelocity, CircularText, CountUp, ScrambledText,
|
||||||
|
StickerPeel, HalftoneReveal, FaultyTerminal, StaggeredMenu (mobile menu).
|
||||||
|
- WebGL pieces (`HalftoneReveal`, `FaultyTerminal`) use `client:only="react"`; the 3D viewer
|
||||||
|
library loads only when a model scrolls near the screen.
|
||||||
|
|
||||||
|
### Mobile first
|
||||||
|
|
||||||
|
Base styles target phones; desktop layouts are added with `min-width` media queries. Keep tap
|
||||||
|
targets ≥ 44px, and wrap anything that overhangs inside `main` (which clips horizontal overflow).
|
||||||
|
|
||||||
## Media share (Nextcloud)
|
## Media share (Nextcloud)
|
||||||
|
|
||||||
|
|||||||
@@ -22,7 +22,11 @@
|
|||||||
"@fontsource/vt323": "^5.3.0",
|
"@fontsource/vt323": "^5.3.0",
|
||||||
"@google/model-viewer": "^4.3.1",
|
"@google/model-viewer": "^4.3.1",
|
||||||
"astro": "^7.3.7",
|
"astro": "^7.3.7",
|
||||||
|
"gsap": "^3.15.0",
|
||||||
|
"lenis": "^1.3.26",
|
||||||
|
"motion": "^14.0.0",
|
||||||
"nodemailer": "^10.0.16",
|
"nodemailer": "^10.0.16",
|
||||||
|
"ogl": "^1.0.11",
|
||||||
"react": "^19.3.0",
|
"react": "^19.3.0",
|
||||||
"react-dom": "^19.3.0",
|
"react-dom": "^19.3.0",
|
||||||
"sharp": "^0.35.5",
|
"sharp": "^0.35.5",
|
||||||
@@ -3420,6 +3424,29 @@
|
|||||||
"node": ">=20"
|
"node": ">=20"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"node_modules/framer-motion": {
|
||||||
|
"version": "14.0.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/framer-motion/-/framer-motion-14.0.0.tgz",
|
||||||
|
"integrity": "sha512-QAtHmybrDFSliyW1sexMtSQTQd+1jw2ajibEmzpuI4XdPVzQkn+dAzJMm2sW3pl9MJuSS4xN51djQ7huhlP/VA==",
|
||||||
|
"license": "MIT",
|
||||||
|
"dependencies": {
|
||||||
|
"motion-dom": "14.0.0",
|
||||||
|
"motion-utils": "14.0.0",
|
||||||
|
"tslib": "^2.4.0"
|
||||||
|
},
|
||||||
|
"peerDependencies": {
|
||||||
|
"react": "^18.0.0 || ^19.0.0",
|
||||||
|
"react-dom": "^18.0.0 || ^19.0.0"
|
||||||
|
},
|
||||||
|
"peerDependenciesMeta": {
|
||||||
|
"react": {
|
||||||
|
"optional": true
|
||||||
|
},
|
||||||
|
"react-dom": {
|
||||||
|
"optional": true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
"node_modules/fresh": {
|
"node_modules/fresh": {
|
||||||
"version": "2.0.0",
|
"version": "2.0.0",
|
||||||
"resolved": "https://registry.npmjs.org/fresh/-/fresh-2.0.0.tgz",
|
"resolved": "https://registry.npmjs.org/fresh/-/fresh-2.0.0.tgz",
|
||||||
@@ -3487,6 +3514,12 @@
|
|||||||
"integrity": "sha512-IaOQ9puYtjrkq7Y0Ygl9KDZnrf/aiUJYUpVf89y8kyaxbRG7Y1SrX/jaumrv81vc61+kiMempujsM3Yw7w5qcw==",
|
"integrity": "sha512-IaOQ9puYtjrkq7Y0Ygl9KDZnrf/aiUJYUpVf89y8kyaxbRG7Y1SrX/jaumrv81vc61+kiMempujsM3Yw7w5qcw==",
|
||||||
"license": "ISC"
|
"license": "ISC"
|
||||||
},
|
},
|
||||||
|
"node_modules/gsap": {
|
||||||
|
"version": "3.15.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/gsap/-/gsap-3.15.0.tgz",
|
||||||
|
"integrity": "sha512-dMW4CWBTUK1AEEDeZc1g4xpPGIrSf9fJF960qbTZmN/QwZIWY5wgliS6JWl9/25fpTGJrMRtSjGtOmPnfjZB+A==",
|
||||||
|
"license": "Standard 'no charge' license: https://gsap.com/standard-license."
|
||||||
|
},
|
||||||
"node_modules/h3": {
|
"node_modules/h3": {
|
||||||
"version": "1.15.11",
|
"version": "1.15.11",
|
||||||
"resolved": "https://registry.npmjs.org/h3/-/h3-1.15.11.tgz",
|
"resolved": "https://registry.npmjs.org/h3/-/h3-1.15.11.tgz",
|
||||||
@@ -3671,6 +3704,37 @@
|
|||||||
"node": ">=6"
|
"node": ">=6"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"node_modules/lenis": {
|
||||||
|
"version": "1.3.26",
|
||||||
|
"resolved": "https://registry.npmjs.org/lenis/-/lenis-1.3.26.tgz",
|
||||||
|
"integrity": "sha512-s/xTCZCxTFvHbAN1OzuhNaN5YPJH2ail0XAkctKW1b+RUAG4nUL5UHLXwNko1h8aEeT2jspBXegMgPJd8zcuag==",
|
||||||
|
"license": "MIT",
|
||||||
|
"workspaces": [
|
||||||
|
"packages/*",
|
||||||
|
"playground",
|
||||||
|
"playground/*"
|
||||||
|
],
|
||||||
|
"funding": {
|
||||||
|
"type": "github",
|
||||||
|
"url": "https://github.com/sponsors/darkroomengineering"
|
||||||
|
},
|
||||||
|
"peerDependencies": {
|
||||||
|
"@nuxt/kit": ">=3.0.0",
|
||||||
|
"react": ">=17.0.0",
|
||||||
|
"vue": ">=3.0.0"
|
||||||
|
},
|
||||||
|
"peerDependenciesMeta": {
|
||||||
|
"@nuxt/kit": {
|
||||||
|
"optional": true
|
||||||
|
},
|
||||||
|
"react": {
|
||||||
|
"optional": true
|
||||||
|
},
|
||||||
|
"vue": {
|
||||||
|
"optional": true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
"node_modules/lie": {
|
"node_modules/lie": {
|
||||||
"version": "3.3.0",
|
"version": "3.3.0",
|
||||||
"resolved": "https://registry.npmjs.org/lie/-/lie-3.3.0.tgz",
|
"resolved": "https://registry.npmjs.org/lie/-/lie-3.3.0.tgz",
|
||||||
@@ -4130,6 +4194,43 @@
|
|||||||
"url": "https://opencollective.com/express"
|
"url": "https://opencollective.com/express"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"node_modules/motion": {
|
||||||
|
"version": "14.0.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/motion/-/motion-14.0.0.tgz",
|
||||||
|
"integrity": "sha512-oGc2lkge2lkRZCP+J8/JsnYu4NFjqP1MtXirNdetn3QbvK2JqwM9A200EdT4C598KfzDhjLT12zF21xDM4Oilw==",
|
||||||
|
"license": "MIT",
|
||||||
|
"dependencies": {
|
||||||
|
"framer-motion": "14.0.0",
|
||||||
|
"tslib": "^2.4.0"
|
||||||
|
},
|
||||||
|
"peerDependencies": {
|
||||||
|
"react": "^18.0.0 || ^19.0.0",
|
||||||
|
"react-dom": "^18.0.0 || ^19.0.0"
|
||||||
|
},
|
||||||
|
"peerDependenciesMeta": {
|
||||||
|
"react": {
|
||||||
|
"optional": true
|
||||||
|
},
|
||||||
|
"react-dom": {
|
||||||
|
"optional": true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/motion-dom": {
|
||||||
|
"version": "14.0.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/motion-dom/-/motion-dom-14.0.0.tgz",
|
||||||
|
"integrity": "sha512-aU3ApXo1yTpeUi3JU+jbDk2TELjxPE3MbBMUP7nZHlARb6RweJK+ojmLjpuB0YsY6zhbBl1YWGo8LMsI1/Llqw==",
|
||||||
|
"license": "MIT",
|
||||||
|
"dependencies": {
|
||||||
|
"motion-utils": "14.0.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/motion-utils": {
|
||||||
|
"version": "14.0.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/motion-utils/-/motion-utils-14.0.0.tgz",
|
||||||
|
"integrity": "sha512-jBsyjVxTTRZNeuvd/v+btVXr90LQkYl4HhRu9T2ARc+PMnvkmjsjRVeAg4Qm10b6TlTw+kykWI8gu/6LuvpLSQ==",
|
||||||
|
"license": "MIT"
|
||||||
|
},
|
||||||
"node_modules/mrmime": {
|
"node_modules/mrmime": {
|
||||||
"version": "2.0.1",
|
"version": "2.0.1",
|
||||||
"resolved": "https://registry.npmjs.org/mrmime/-/mrmime-2.0.1.tgz",
|
"resolved": "https://registry.npmjs.org/mrmime/-/mrmime-2.0.1.tgz",
|
||||||
@@ -4258,6 +4359,12 @@
|
|||||||
"ufo": "^1.6.1"
|
"ufo": "^1.6.1"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"node_modules/ogl": {
|
||||||
|
"version": "1.0.11",
|
||||||
|
"resolved": "https://registry.npmjs.org/ogl/-/ogl-1.0.11.tgz",
|
||||||
|
"integrity": "sha512-kUpC154AFfxi16pmZUK4jk3J+8zxwTWGPo03EoYA8QPbzikHoaC82n6pNTbd+oEaJonaE8aPWBlX7ad9zrqLsA==",
|
||||||
|
"license": "Unlicense"
|
||||||
|
},
|
||||||
"node_modules/ohash": {
|
"node_modules/ohash": {
|
||||||
"version": "2.0.12",
|
"version": "2.0.12",
|
||||||
"resolved": "https://registry.npmjs.org/ohash/-/ohash-2.0.12.tgz",
|
"resolved": "https://registry.npmjs.org/ohash/-/ohash-2.0.12.tgz",
|
||||||
@@ -5009,7 +5116,6 @@
|
|||||||
"version": "2.8.1",
|
"version": "2.8.1",
|
||||||
"resolved": "https://registry.npmjs.org/tslib/-/tslib-2.8.1.tgz",
|
"resolved": "https://registry.npmjs.org/tslib/-/tslib-2.8.1.tgz",
|
||||||
"integrity": "sha512-oJFu94HQb+KVduSUQL7wnpmqnfmLsOA/nAh6b6EH0wCEoK0/mPeXU6c3wKDV83MkOuHPRHtSXKKU99IBazS/2w==",
|
"integrity": "sha512-oJFu94HQb+KVduSUQL7wnpmqnfmLsOA/nAh6b6EH0wCEoK0/mPeXU6c3wKDV83MkOuHPRHtSXKKU99IBazS/2w==",
|
||||||
"devOptional": true,
|
|
||||||
"license": "0BSD"
|
"license": "0BSD"
|
||||||
},
|
},
|
||||||
"node_modules/typesafe-path": {
|
"node_modules/typesafe-path": {
|
||||||
|
|||||||
@@ -28,7 +28,11 @@
|
|||||||
"@fontsource/vt323": "^5.3.0",
|
"@fontsource/vt323": "^5.3.0",
|
||||||
"@google/model-viewer": "^4.3.1",
|
"@google/model-viewer": "^4.3.1",
|
||||||
"astro": "^7.3.7",
|
"astro": "^7.3.7",
|
||||||
|
"gsap": "^3.15.0",
|
||||||
|
"lenis": "^1.3.26",
|
||||||
|
"motion": "^14.0.0",
|
||||||
"nodemailer": "^10.0.16",
|
"nodemailer": "^10.0.16",
|
||||||
|
"ogl": "^1.0.11",
|
||||||
"react": "^19.3.0",
|
"react": "^19.3.0",
|
||||||
"react-dom": "^19.3.0",
|
"react-dom": "^19.3.0",
|
||||||
"sharp": "^0.35.5",
|
"sharp": "^0.35.5",
|
||||||
|
|||||||
|
After Width: | Height: | Size: 80 KiB |
|
After Width: | Height: | Size: 158 KiB |
|
After Width: | Height: | Size: 178 KiB |
|
After Width: | Height: | Size: 92 KiB |
|
After Width: | Height: | Size: 105 KiB |
|
After Width: | Height: | Size: 227 KiB |
|
After Width: | Height: | Size: 97 KiB |
|
After Width: | Height: | Size: 198 KiB |
|
After Width: | Height: | Size: 71 KiB |
|
After Width: | Height: | Size: 294 KiB |
|
After Width: | Height: | Size: 115 KiB |
|
After Width: | Height: | Size: 525 KiB |
|
After Width: | Height: | Size: 312 KiB |
|
After Width: | Height: | Size: 89 KiB |
|
After Width: | Height: | Size: 111 KiB |
|
After Width: | Height: | Size: 54 KiB |
|
After Width: | Height: | Size: 95 KiB |
|
After Width: | Height: | Size: 292 KiB |
|
After Width: | Height: | Size: 502 KiB |
|
After Width: | Height: | Size: 184 KiB |
|
After Width: | Height: | Size: 94 KiB |
|
After Width: | Height: | Size: 160 KiB |
|
After Width: | Height: | Size: 188 KiB |
|
After Width: | Height: | Size: 330 KiB |
|
After Width: | Height: | Size: 210 KiB |
|
After Width: | Height: | Size: 675 KiB |
|
After Width: | Height: | Size: 220 KiB |
|
After Width: | Height: | Size: 86 KiB |
|
After Width: | Height: | Size: 133 KiB |
|
After Width: | Height: | Size: 139 KiB |
@@ -0,0 +1,18 @@
|
|||||||
|
---
|
||||||
|
// Six-pointed star from the Chicago flag.
|
||||||
|
interface Props {
|
||||||
|
size?: string;
|
||||||
|
color?: string;
|
||||||
|
class?: string;
|
||||||
|
}
|
||||||
|
const { size = '1.6rem', color = 'var(--chicago-star)', class: cls } = Astro.props;
|
||||||
|
const pts = Array.from({ length: 12 }, (_, i) => {
|
||||||
|
const r = i % 2 === 0 ? 50 : 26;
|
||||||
|
const a = (Math.PI / 6) * i - Math.PI / 2;
|
||||||
|
return `${(50 + r * Math.cos(a)).toFixed(2)},${(50 + r * Math.sin(a)).toFixed(2)}`;
|
||||||
|
}).join(' ');
|
||||||
|
---
|
||||||
|
|
||||||
|
<svg class={cls} viewBox="0 0 100 100" width={size} height={size} aria-hidden="true" style={`flex:none;width:${size};height:${size}`}>
|
||||||
|
<polygon points={pts} fill={color} />
|
||||||
|
</svg>
|
||||||
@@ -1,16 +1,18 @@
|
|||||||
---
|
---
|
||||||
import { SITE, NAV } from '../lib/site';
|
import { SITE } from '../lib/site';
|
||||||
|
import ChicagoStar from './ChicagoStar.astro';
|
||||||
const year = new Date().getFullYear();
|
const year = new Date().getFullYear();
|
||||||
const links = Object.entries(SITE.links).filter(([, href]) => !href.includes('PLACEHOLDER'));
|
const links = Object.entries(SITE.links).filter(([, href]) => !href.includes('PLACEHOLDER'));
|
||||||
|
const lines = ['--cta-red', '--cta-blue', '--cta-brown', '--cta-green', '--cta-orange', '--cta-purple', '--cta-pink', '--cta-yellow'];
|
||||||
---
|
---
|
||||||
|
|
||||||
<footer>
|
<footer>
|
||||||
<div class="lines" aria-hidden="true">
|
<div class="lines" aria-hidden="true">
|
||||||
{NAV.map((n) => <span style={`--c:${n.color}`} />)}
|
{lines.map((l) => <span style={`--c:var(${l})`} />)}
|
||||||
</div>
|
</div>
|
||||||
<div class="wrap grid">
|
<div class="wrap grid">
|
||||||
<div class="stack">
|
<div class="stack">
|
||||||
<p class="big">Let's build something.</p>
|
<p class="big" data-reveal>Let's build something.</p>
|
||||||
<p class="cluster">
|
<p class="cluster">
|
||||||
<a class="btn btn--primary" href="/contact">Get in touch</a>
|
<a class="btn btn--primary" href="/contact">Get in touch</a>
|
||||||
<a class="btn" href={SITE.resume}>Résumé</a>
|
<a class="btn" href={SITE.resume}>Résumé</a>
|
||||||
@@ -35,9 +37,16 @@ const links = Object.entries(SITE.links).filter(([, href]) => !href.includes('PL
|
|||||||
<dd><a href="/rss.xml">yoyos.sh/rss.xml</a></dd>
|
<dd><a href="/rss.xml">yoyos.sh/rss.xml</a></dd>
|
||||||
</dl>
|
</dl>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<div class="flag" aria-hidden="true">
|
||||||
|
<span class="stripe"></span>
|
||||||
|
<span class="stars">{[0, 1, 2, 3].map(() => <ChicagoStar size="clamp(1.6rem, 6vw, 2.6rem)" />)}</span>
|
||||||
|
<span class="stripe"></span>
|
||||||
|
</div>
|
||||||
|
|
||||||
<div class="wrap base">
|
<div class="wrap base">
|
||||||
<span>© {year} {SITE.name}</span>
|
<span>© {year} {SITE.name} · Chicago, IL</span>
|
||||||
<span>{SITE.location}</span>
|
<a href="/credits">Photo credits</a>
|
||||||
<span>Self-hosted · Built with Astro</span>
|
<span>Self-hosted · Built with Astro</span>
|
||||||
</div>
|
</div>
|
||||||
</footer>
|
</footer>
|
||||||
@@ -47,9 +56,9 @@ const links = Object.entries(SITE.links).filter(([, href]) => !href.includes('PL
|
|||||||
margin-top: var(--space-9);
|
margin-top: var(--space-9);
|
||||||
background: var(--ink);
|
background: var(--ink);
|
||||||
color: var(--paper);
|
color: var(--paper);
|
||||||
padding-bottom: var(--space-5);
|
padding-bottom: calc(var(--space-5) + env(safe-area-inset-bottom));
|
||||||
--fg-muted: #a8a294;
|
--fg-muted: #a8a294;
|
||||||
--accent: var(--lime);
|
--accent: var(--cta-yellow);
|
||||||
--accent-fg: var(--ink);
|
--accent-fg: var(--ink);
|
||||||
--line-strong: var(--paper);
|
--line-strong: var(--paper);
|
||||||
--bg-raised: transparent;
|
--bg-raised: transparent;
|
||||||
@@ -57,7 +66,7 @@ const links = Object.entries(SITE.links).filter(([, href]) => !href.includes('PL
|
|||||||
}
|
}
|
||||||
.lines {
|
.lines {
|
||||||
display: grid;
|
display: grid;
|
||||||
grid-template-columns: repeat(6, 1fr);
|
grid-template-columns: repeat(8, 1fr);
|
||||||
height: 10px;
|
height: 10px;
|
||||||
}
|
}
|
||||||
.lines span {
|
.lines span {
|
||||||
@@ -72,23 +81,43 @@ const links = Object.entries(SITE.links).filter(([, href]) => !href.includes('PL
|
|||||||
}
|
}
|
||||||
.big {
|
.big {
|
||||||
font-family: var(--ff-mag);
|
font-family: var(--ff-mag);
|
||||||
font-size: var(--step-4);
|
font-size: clamp(2.6rem, 9vw, 4.75rem);
|
||||||
line-height: 1;
|
line-height: 1;
|
||||||
letter-spacing: -0.02em;
|
letter-spacing: -0.02em;
|
||||||
}
|
}
|
||||||
.readout {
|
.readout {
|
||||||
font-family: var(--ff-mono);
|
font-family: var(--ff-mono);
|
||||||
}
|
}
|
||||||
|
.readout dd {
|
||||||
|
overflow-wrap: anywhere;
|
||||||
|
}
|
||||||
|
.flag {
|
||||||
|
display: grid;
|
||||||
|
gap: 0.6rem;
|
||||||
|
margin-top: var(--space-8);
|
||||||
|
padding-block: 0.9rem;
|
||||||
|
background: #fff;
|
||||||
|
}
|
||||||
|
.stripe {
|
||||||
|
height: clamp(10px, 2.2vw, 18px);
|
||||||
|
background: var(--chicago-blue);
|
||||||
|
}
|
||||||
|
.stars {
|
||||||
|
display: flex;
|
||||||
|
justify-content: center;
|
||||||
|
gap: clamp(1rem, 6vw, 3.5rem);
|
||||||
|
}
|
||||||
.base {
|
.base {
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-wrap: wrap;
|
flex-wrap: wrap;
|
||||||
justify-content: space-between;
|
justify-content: space-between;
|
||||||
gap: var(--space-3);
|
gap: var(--space-3);
|
||||||
margin-top: var(--space-7);
|
margin-top: var(--space-5);
|
||||||
padding-top: var(--space-4);
|
|
||||||
border-top: 1px solid #3a3a34;
|
|
||||||
font-family: var(--ff-mono);
|
font-family: var(--ff-mono);
|
||||||
font-size: 0.75rem;
|
font-size: 0.75rem;
|
||||||
color: #a8a294;
|
color: #a8a294;
|
||||||
}
|
}
|
||||||
|
.base a {
|
||||||
|
color: inherit;
|
||||||
|
}
|
||||||
</style>
|
</style>
|
||||||
@@ -0,0 +1,116 @@
|
|||||||
|
/* Overrides for React Bits' StaggeredMenu: CTA station list on cream stock. */
|
||||||
|
.yo-menu.staggered-menu-wrapper.fixed-wrapper {
|
||||||
|
z-index: 200;
|
||||||
|
height: 100dvh;
|
||||||
|
width: 100%;
|
||||||
|
}
|
||||||
|
.yo-menu .staggered-menu-header {
|
||||||
|
height: 3.75rem;
|
||||||
|
padding: 0 var(--gutter);
|
||||||
|
}
|
||||||
|
.yo-menu .sm-toggle {
|
||||||
|
min-height: 44px;
|
||||||
|
padding: 0 0.85rem;
|
||||||
|
gap: 0.5rem;
|
||||||
|
border: 2px solid #141412;
|
||||||
|
border-radius: 999px;
|
||||||
|
background: #fffdf7;
|
||||||
|
font-family: var(--ff-grotesk);
|
||||||
|
font-weight: 700;
|
||||||
|
font-size: 0.95rem;
|
||||||
|
}
|
||||||
|
.yo-menu .sm-prelayers,
|
||||||
|
.yo-menu .staggered-menu-panel {
|
||||||
|
width: 100%;
|
||||||
|
}
|
||||||
|
.yo-menu .staggered-menu-panel {
|
||||||
|
background: #f4f1e8;
|
||||||
|
padding: 5.5rem var(--gutter) 2rem;
|
||||||
|
backdrop-filter: none;
|
||||||
|
}
|
||||||
|
.yo-menu .sm-panel-list {
|
||||||
|
position: relative;
|
||||||
|
gap: 0;
|
||||||
|
padding-left: 2.6rem;
|
||||||
|
}
|
||||||
|
.yo-menu .sm-panel-list::before {
|
||||||
|
content: '';
|
||||||
|
position: absolute;
|
||||||
|
left: 0.85rem;
|
||||||
|
top: 1.2rem;
|
||||||
|
bottom: 1.2rem;
|
||||||
|
width: 6px;
|
||||||
|
border-radius: 3px;
|
||||||
|
background: #141412;
|
||||||
|
}
|
||||||
|
.yo-menu .sm-panel-itemWrap {
|
||||||
|
overflow: visible;
|
||||||
|
}
|
||||||
|
.yo-menu .sm-panel-item {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
min-height: 3.6rem;
|
||||||
|
padding: 0.35rem 0;
|
||||||
|
font-family: var(--ff-grotesk);
|
||||||
|
font-weight: 800;
|
||||||
|
font-size: clamp(2.3rem, 11vw, 3.4rem);
|
||||||
|
letter-spacing: -0.04em;
|
||||||
|
text-transform: none;
|
||||||
|
color: #141412;
|
||||||
|
}
|
||||||
|
.yo-menu .sm-panel-item::before {
|
||||||
|
content: '';
|
||||||
|
position: absolute;
|
||||||
|
left: -2.6rem;
|
||||||
|
top: 50%;
|
||||||
|
width: 1.4rem;
|
||||||
|
height: 1.4rem;
|
||||||
|
margin-left: 0.3rem;
|
||||||
|
translate: 0 -50%;
|
||||||
|
border-radius: 50%;
|
||||||
|
background: var(--item-color, #141412);
|
||||||
|
border: 4px solid #141412;
|
||||||
|
box-sizing: border-box;
|
||||||
|
}
|
||||||
|
.yo-menu .sm-panel-item[aria-current='page'] {
|
||||||
|
color: var(--item-color);
|
||||||
|
}
|
||||||
|
.yo-menu .sm-panel-item[aria-current='page']::before {
|
||||||
|
background: #fff;
|
||||||
|
border-color: var(--item-color);
|
||||||
|
}
|
||||||
|
.yo-menu .sm-panel-item:hover {
|
||||||
|
color: var(--item-color, #c60c30);
|
||||||
|
}
|
||||||
|
.yo-menu-foot {
|
||||||
|
margin-top: auto;
|
||||||
|
padding-top: 2rem;
|
||||||
|
display: grid;
|
||||||
|
gap: 0.4rem;
|
||||||
|
font-family: var(--ff-mono);
|
||||||
|
font-size: 0.9rem;
|
||||||
|
color: #141412;
|
||||||
|
}
|
||||||
|
.yo-menu-foot a {
|
||||||
|
color: #141412;
|
||||||
|
text-decoration-color: #c60c30;
|
||||||
|
}
|
||||||
|
.yo-menu-status {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
gap: 0.5rem;
|
||||||
|
}
|
||||||
|
.yo-menu-status span {
|
||||||
|
width: 0.6rem;
|
||||||
|
height: 0.6rem;
|
||||||
|
border-radius: 50%;
|
||||||
|
background: #2fd36b;
|
||||||
|
}
|
||||||
|
html.menu-open {
|
||||||
|
overflow: hidden;
|
||||||
|
}
|
||||||
|
@media (min-width: 56.01rem) {
|
||||||
|
.yo-menu {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,53 @@
|
|||||||
|
import StaggeredMenu from './bits/StaggeredMenu';
|
||||||
|
import './MobileMenu.css';
|
||||||
|
|
||||||
|
interface Props {
|
||||||
|
items: { href: string; label: string; hex: string }[];
|
||||||
|
current: string;
|
||||||
|
email: string;
|
||||||
|
status: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
type LenisLike = { stop: () => void; start: () => void } | null;
|
||||||
|
const lenis = (): LenisLike => (window as unknown as { __lenis?: () => LenisLike }).__lenis?.() ?? null;
|
||||||
|
|
||||||
|
/** Full-screen mobile menu: each section is a stop on its 'L' line color. */
|
||||||
|
export default function MobileMenu({ items, current, email, status }: Props) {
|
||||||
|
return (
|
||||||
|
<StaggeredMenu
|
||||||
|
className="yo-menu"
|
||||||
|
position="right"
|
||||||
|
isFixed
|
||||||
|
colors={['#c60c30', '#f9e300', '#009b3a', '#00a1de']}
|
||||||
|
accentColor="#c60c30"
|
||||||
|
menuButtonColor="#141412"
|
||||||
|
openMenuButtonColor="#141412"
|
||||||
|
changeMenuColorOnOpen={false}
|
||||||
|
displaySocials={false}
|
||||||
|
displayItemNumbering={false}
|
||||||
|
items={items.map((i) => ({
|
||||||
|
label: i.label,
|
||||||
|
ariaLabel: `Go to ${i.label}`,
|
||||||
|
link: i.href,
|
||||||
|
color: i.hex,
|
||||||
|
current: current === i.href || current.startsWith(i.href + '/'),
|
||||||
|
}))}
|
||||||
|
onMenuOpen={() => {
|
||||||
|
document.documentElement.classList.add('menu-open');
|
||||||
|
lenis()?.stop();
|
||||||
|
}}
|
||||||
|
onMenuClose={() => {
|
||||||
|
document.documentElement.classList.remove('menu-open');
|
||||||
|
lenis()?.start();
|
||||||
|
}}
|
||||||
|
footer={
|
||||||
|
<div className="yo-menu-foot">
|
||||||
|
<p className="yo-menu-status">
|
||||||
|
<span aria-hidden="true" /> {status}
|
||||||
|
</p>
|
||||||
|
<a href={`mailto:${email}`}>{email}</a>
|
||||||
|
</div>
|
||||||
|
}
|
||||||
|
/>
|
||||||
|
);
|
||||||
|
}
|
||||||
@@ -34,17 +34,36 @@ const { src, alt, poster, ratio = '16 / 10' } = Astro.props;
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import '@google/model-viewer';
|
// model-viewer (three.js) is ~280 KB, so only load it when a viewer gets close to the screen.
|
||||||
document.addEventListener('astro:page-load', () => {
|
let loading: Promise<unknown> | null = null;
|
||||||
document.querySelectorAll('model-viewer').forEach((mv) => {
|
const load = () => (loading ??= import('@google/model-viewer'));
|
||||||
const el = mv as HTMLElement & { dismissPoster?: () => void };
|
|
||||||
el.querySelector('.start')?.addEventListener('click', () => el.dismissPoster?.());
|
function setup() {
|
||||||
|
const viewers = document.querySelectorAll<HTMLElement & { dismissPoster?: () => void }>('model-viewer');
|
||||||
|
if (!viewers.length) return;
|
||||||
|
const io = new IntersectionObserver(
|
||||||
|
(entries) => {
|
||||||
|
if (entries.some((e) => e.isIntersecting)) {
|
||||||
|
load();
|
||||||
|
io.disconnect();
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{ rootMargin: '400px' },
|
||||||
|
);
|
||||||
|
viewers.forEach((el) => {
|
||||||
|
io.observe(el);
|
||||||
|
el.querySelector('.start')?.addEventListener('click', async () => {
|
||||||
|
await load();
|
||||||
|
await customElements.whenDefined('model-viewer');
|
||||||
|
el.dismissPoster?.();
|
||||||
|
});
|
||||||
el.addEventListener('error', () => {
|
el.addEventListener('error', () => {
|
||||||
const btn = el.querySelector<HTMLElement>('.start');
|
const btn = el.querySelector<HTMLElement>('.start');
|
||||||
if (btn) btn.textContent = 'This model isn’t available right now.';
|
if (btn) btn.textContent = 'This model isn’t available right now.';
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
}
|
||||||
|
document.addEventListener('astro:page-load', setup);
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style>
|
<style>
|
||||||
|
|||||||
@@ -1,26 +1,24 @@
|
|||||||
---
|
---
|
||||||
import { NAV, SITE } from '../lib/site';
|
import { NAV, SITE } from '../lib/site';
|
||||||
const path = Astro.url.pathname;
|
import ChicagoStar from './ChicagoStar.astro';
|
||||||
|
import MobileMenu from './MobileMenu';
|
||||||
|
const path = Astro.url.pathname.replace(/\/$/, '') || '/';
|
||||||
const isActive = (href: string) => path === href || path.startsWith(href + '/');
|
const isActive = (href: string) => path === href || path.startsWith(href + '/');
|
||||||
---
|
---
|
||||||
|
|
||||||
<header class="bar">
|
<header class="bar">
|
||||||
<div class="wrap row">
|
<div class="wrap row">
|
||||||
<a class="brand" href="/" aria-label={`${SITE.name}, home`}>
|
<a class="brand" href="/" aria-label={`${SITE.name}, home`}>
|
||||||
<span class="mark" aria-hidden="true">yo</span>
|
<ChicagoStar size="1.9rem" />
|
||||||
<span class="name">yoyos.sh</span>
|
<span class="name">yoyos<span class="tld">.sh</span></span>
|
||||||
</a>
|
</a>
|
||||||
|
|
||||||
<nav aria-label="Main">
|
<nav class="desk" aria-label="Main">
|
||||||
<ul>
|
<ul>
|
||||||
{
|
{
|
||||||
NAV.map((item) => (
|
NAV.map((item) => (
|
||||||
<li>
|
<li>
|
||||||
<a
|
<a href={item.href} aria-current={isActive(item.href) ? 'page' : undefined} style={`--c:${item.color};--f:${item.fg}`}>
|
||||||
href={item.href}
|
|
||||||
aria-current={isActive(item.href) ? 'page' : undefined}
|
|
||||||
style={`--c:${item.color};--f:${item.fg}`}
|
|
||||||
>
|
|
||||||
<span class="dot" aria-hidden="true" />
|
<span class="dot" aria-hidden="true" />
|
||||||
{item.label}
|
{item.label}
|
||||||
</a>
|
</a>
|
||||||
@@ -32,18 +30,26 @@ const isActive = (href: string) => path === href || path.startsWith(href + '/');
|
|||||||
|
|
||||||
<a class="status" href="/contact" title={SITE.availability.text}>
|
<a class="status" href="/contact" title={SITE.availability.text}>
|
||||||
<span class:list={['led', { off: !SITE.availability.open }]} aria-hidden="true"></span>
|
<span class:list={['led', { off: !SITE.availability.open }]} aria-hidden="true"></span>
|
||||||
{SITE.availability.open ? 'Available for work' : 'Not available'}
|
<span class="status-text">{SITE.availability.open ? 'Available for work' : 'Not available'}</span>
|
||||||
</a>
|
</a>
|
||||||
</div>
|
</div>
|
||||||
</header>
|
</header>
|
||||||
|
<MobileMenu
|
||||||
|
client:media="(max-width: 56rem)"
|
||||||
|
items={NAV.map((n) => ({ href: n.href, label: n.label, hex: n.hex }))}
|
||||||
|
current={path}
|
||||||
|
email={SITE.email}
|
||||||
|
status={SITE.availability.text}
|
||||||
|
/>
|
||||||
|
|
||||||
<style>
|
<style>
|
||||||
.bar {
|
.bar {
|
||||||
position: sticky;
|
position: sticky;
|
||||||
top: 0;
|
top: 0;
|
||||||
z-index: 100;
|
z-index: 100;
|
||||||
background: color-mix(in oklab, var(--bg) 90%, transparent);
|
background: color-mix(in oklab, var(--bg) 92%, transparent);
|
||||||
backdrop-filter: blur(8px);
|
backdrop-filter: blur(10px);
|
||||||
|
-webkit-backdrop-filter: blur(10px);
|
||||||
border-bottom: var(--border-w) solid var(--line-strong);
|
border-bottom: var(--border-w) solid var(--line-strong);
|
||||||
}
|
}
|
||||||
.row {
|
.row {
|
||||||
@@ -55,36 +61,31 @@ const isActive = (href: string) => path === href || path.startsWith(href + '/');
|
|||||||
.brand {
|
.brand {
|
||||||
display: flex;
|
display: flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
gap: 0.55rem;
|
gap: 0.45rem;
|
||||||
|
min-height: 44px;
|
||||||
text-decoration: none;
|
text-decoration: none;
|
||||||
font-family: var(--ff-grotesk);
|
font-family: var(--ff-grotesk);
|
||||||
font-weight: 800;
|
font-weight: 800;
|
||||||
font-stretch: 110%;
|
font-stretch: 112%;
|
||||||
letter-spacing: -0.02em;
|
font-size: 1.15rem;
|
||||||
|
letter-spacing: -0.03em;
|
||||||
color: var(--fg);
|
color: var(--fg);
|
||||||
}
|
}
|
||||||
.mark {
|
.brand :global(svg) {
|
||||||
display: grid;
|
transition: rotate 0.6s var(--ease);
|
||||||
place-items: center;
|
|
||||||
width: 2.2rem;
|
|
||||||
height: 2.2rem;
|
|
||||||
border-radius: 50%;
|
|
||||||
background: var(--red);
|
|
||||||
color: #fff;
|
|
||||||
font-family: var(--ff-mag);
|
|
||||||
font-size: 0.95rem;
|
|
||||||
font-weight: 400;
|
|
||||||
letter-spacing: -0.04em;
|
|
||||||
}
|
}
|
||||||
nav {
|
.brand:hover :global(svg) {
|
||||||
min-width: 0;
|
rotate: 60deg;
|
||||||
|
}
|
||||||
|
.tld {
|
||||||
|
color: var(--fg-muted);
|
||||||
|
}
|
||||||
|
.desk {
|
||||||
margin-inline-start: auto;
|
margin-inline-start: auto;
|
||||||
overflow-x: auto;
|
|
||||||
scrollbar-width: none;
|
|
||||||
}
|
}
|
||||||
ul {
|
ul {
|
||||||
display: flex;
|
display: flex;
|
||||||
gap: var(--space-1);
|
gap: 2px;
|
||||||
list-style: none;
|
list-style: none;
|
||||||
padding: 0;
|
padding: 0;
|
||||||
}
|
}
|
||||||
@@ -96,15 +97,15 @@ const isActive = (href: string) => path === href || path.startsWith(href + '/');
|
|||||||
border-radius: 999px;
|
border-radius: 999px;
|
||||||
border: var(--border-w) solid transparent;
|
border: var(--border-w) solid transparent;
|
||||||
font-family: var(--ff-grotesk);
|
font-family: var(--ff-grotesk);
|
||||||
font-weight: 600;
|
font-weight: 650;
|
||||||
font-size: 0.92rem;
|
font-size: 0.92rem;
|
||||||
text-decoration: none;
|
text-decoration: none;
|
||||||
white-space: nowrap;
|
white-space: nowrap;
|
||||||
color: var(--fg);
|
color: var(--fg);
|
||||||
}
|
}
|
||||||
.dot {
|
.dot {
|
||||||
width: 0.7em;
|
width: 0.72em;
|
||||||
height: 0.7em;
|
height: 0.72em;
|
||||||
border-radius: 50%;
|
border-radius: 50%;
|
||||||
background: var(--c);
|
background: var(--c);
|
||||||
box-shadow: 0 0 0 1.5px var(--line-strong);
|
box-shadow: 0 0 0 1.5px var(--line-strong);
|
||||||
@@ -136,32 +137,36 @@ const isActive = (href: string) => path === href || path.startsWith(href + '/');
|
|||||||
height: 0.6rem;
|
height: 0.6rem;
|
||||||
border-radius: 50%;
|
border-radius: 50%;
|
||||||
background: #2fd36b;
|
background: #2fd36b;
|
||||||
box-shadow: 0 0 0 2px color-mix(in oklab, #2fd36b 30%, transparent);
|
|
||||||
animation: pulse 2.4s var(--ease) infinite;
|
animation: pulse 2.4s var(--ease) infinite;
|
||||||
}
|
}
|
||||||
.led.off {
|
.led.off {
|
||||||
background: var(--red);
|
background: var(--cta-red);
|
||||||
animation: none;
|
animation: none;
|
||||||
}
|
}
|
||||||
@keyframes pulse {
|
@keyframes pulse {
|
||||||
50% {
|
0% {
|
||||||
box-shadow: 0 0 0 6px transparent;
|
box-shadow: 0 0 0 0 color-mix(in oklab, #2fd36b 60%, transparent);
|
||||||
|
}
|
||||||
|
70%,
|
||||||
|
100% {
|
||||||
|
box-shadow: 0 0 0 8px transparent;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@media (max-width: 56rem) {
|
@media (max-width: 56rem) {
|
||||||
|
.desk {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
.row {
|
.row {
|
||||||
flex-wrap: wrap;
|
padding-right: 6.5rem; /* room for the fixed menu button */
|
||||||
gap: var(--space-2) var(--space-4);
|
|
||||||
padding-block: var(--space-2);
|
|
||||||
}
|
}
|
||||||
.status {
|
.status {
|
||||||
margin-inline-start: auto;
|
margin-inline-start: auto;
|
||||||
}
|
}
|
||||||
nav {
|
}
|
||||||
order: 3;
|
@media (max-width: 26rem) {
|
||||||
flex-basis: 100%;
|
.status-text {
|
||||||
margin-inline: calc(-1 * var(--space-2));
|
display: none;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
@@ -0,0 +1,24 @@
|
|||||||
|
.circular-text {
|
||||||
|
margin: 0 auto;
|
||||||
|
border-radius: 50%;
|
||||||
|
width: 200px;
|
||||||
|
height: 200px;
|
||||||
|
font-weight: bold;
|
||||||
|
color: #fff;
|
||||||
|
font-weight: 900;
|
||||||
|
text-align: center;
|
||||||
|
cursor: pointer;
|
||||||
|
transform-origin: 50% 50%;
|
||||||
|
-webkit-transform-origin: 50% 50%;
|
||||||
|
}
|
||||||
|
|
||||||
|
.circular-text span {
|
||||||
|
position: absolute;
|
||||||
|
display: inline-block;
|
||||||
|
left: 0;
|
||||||
|
right: 0;
|
||||||
|
top: 0;
|
||||||
|
bottom: 0;
|
||||||
|
font-size: 24px;
|
||||||
|
transition: all 0.5s cubic-bezier(0, 0, 0, 1);
|
||||||
|
}
|
||||||
@@ -0,0 +1,124 @@
|
|||||||
|
// CircularText — from React Bits (https://github.com/DavidHDev/react-bits)
|
||||||
|
// Copyright (c) 2026 David Haz. MIT + Commons Clause. Adapted for yoyos.sh.
|
||||||
|
'use client';
|
||||||
|
|
||||||
|
import React, { useEffect } from 'react';
|
||||||
|
import { motion, useAnimation, useMotionValue, MotionValue, type Transition } from 'motion/react';
|
||||||
|
|
||||||
|
import './CircularText.css';
|
||||||
|
interface CircularTextProps {
|
||||||
|
text: string;
|
||||||
|
spinDuration?: number;
|
||||||
|
onHover?: 'slowDown' | 'speedUp' | 'pause' | 'goBonkers';
|
||||||
|
className?: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
const getRotationTransition = (duration: number, from: number, loop: boolean = true) => ({
|
||||||
|
from,
|
||||||
|
to: from + 360,
|
||||||
|
ease: 'linear' as const,
|
||||||
|
duration,
|
||||||
|
type: 'tween' as const,
|
||||||
|
repeat: loop ? Infinity : 0
|
||||||
|
});
|
||||||
|
|
||||||
|
const getTransition = (duration: number, from: number) => ({
|
||||||
|
rotate: getRotationTransition(duration, from),
|
||||||
|
scale: {
|
||||||
|
type: 'spring' as const,
|
||||||
|
damping: 20,
|
||||||
|
stiffness: 300
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
const CircularText: React.FC<CircularTextProps> = ({
|
||||||
|
text,
|
||||||
|
spinDuration = 20,
|
||||||
|
onHover = 'speedUp',
|
||||||
|
className = ''
|
||||||
|
}) => {
|
||||||
|
const letters = Array.from(text);
|
||||||
|
const controls = useAnimation();
|
||||||
|
const rotation: MotionValue<number> = useMotionValue(0);
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
const start = rotation.get();
|
||||||
|
controls.start({
|
||||||
|
rotate: start + 360,
|
||||||
|
scale: 1,
|
||||||
|
transition: getTransition(spinDuration, start)
|
||||||
|
});
|
||||||
|
}, [spinDuration, text, onHover, controls]);
|
||||||
|
|
||||||
|
const handleHoverStart = () => {
|
||||||
|
const start = rotation.get();
|
||||||
|
|
||||||
|
if (!onHover) return;
|
||||||
|
|
||||||
|
let transitionConfig: ReturnType<typeof getTransition> | Transition;
|
||||||
|
let scaleVal = 1;
|
||||||
|
|
||||||
|
switch (onHover) {
|
||||||
|
case 'slowDown':
|
||||||
|
transitionConfig = getTransition(spinDuration * 2, start);
|
||||||
|
break;
|
||||||
|
case 'speedUp':
|
||||||
|
transitionConfig = getTransition(spinDuration / 4, start);
|
||||||
|
break;
|
||||||
|
case 'pause':
|
||||||
|
transitionConfig = {
|
||||||
|
rotate: { type: 'spring', damping: 20, stiffness: 300 },
|
||||||
|
scale: { type: 'spring', damping: 20, stiffness: 300 }
|
||||||
|
};
|
||||||
|
break;
|
||||||
|
case 'goBonkers':
|
||||||
|
transitionConfig = getTransition(spinDuration / 20, start);
|
||||||
|
scaleVal = 0.8;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
transitionConfig = getTransition(spinDuration, start);
|
||||||
|
}
|
||||||
|
|
||||||
|
controls.start({
|
||||||
|
rotate: start + 360,
|
||||||
|
scale: scaleVal,
|
||||||
|
transition: transitionConfig
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
const handleHoverEnd = () => {
|
||||||
|
const start = rotation.get();
|
||||||
|
controls.start({
|
||||||
|
rotate: start + 360,
|
||||||
|
scale: 1,
|
||||||
|
transition: getTransition(spinDuration, start)
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
return (
|
||||||
|
<motion.div
|
||||||
|
className={`circular-text ${className}`}
|
||||||
|
style={{ rotate: rotation }}
|
||||||
|
initial={{ rotate: 0 }}
|
||||||
|
animate={controls}
|
||||||
|
onMouseEnter={handleHoverStart}
|
||||||
|
onMouseLeave={handleHoverEnd}
|
||||||
|
>
|
||||||
|
{letters.map((letter, i) => {
|
||||||
|
const rotationDeg = (360 / letters.length) * i;
|
||||||
|
const factor = Math.PI / letters.length;
|
||||||
|
const x = factor * i;
|
||||||
|
const y = factor * i;
|
||||||
|
const transform = `rotateZ(${rotationDeg}deg) translate3d(${x}px, ${y}px, 0)`;
|
||||||
|
|
||||||
|
return (
|
||||||
|
<span key={i} style={{ transform, WebkitTransform: transform }}>
|
||||||
|
{letter}
|
||||||
|
</span>
|
||||||
|
);
|
||||||
|
})}
|
||||||
|
</motion.div>
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
export default CircularText;
|
||||||
@@ -0,0 +1,125 @@
|
|||||||
|
// CountUp — from React Bits (https://github.com/DavidHDev/react-bits)
|
||||||
|
// Copyright (c) 2026 David Haz. MIT + Commons Clause. Adapted for yoyos.sh.
|
||||||
|
'use client';
|
||||||
|
|
||||||
|
import { useInView, useMotionValue, useReducedMotion, useSpring } from 'motion/react';
|
||||||
|
import { useCallback, useEffect, useRef } from 'react';
|
||||||
|
|
||||||
|
interface CountUpProps {
|
||||||
|
to: number;
|
||||||
|
from?: number;
|
||||||
|
direction?: 'up' | 'down';
|
||||||
|
delay?: number;
|
||||||
|
duration?: number;
|
||||||
|
className?: string;
|
||||||
|
startWhen?: boolean;
|
||||||
|
separator?: string;
|
||||||
|
onStart?: () => void;
|
||||||
|
onEnd?: () => void;
|
||||||
|
}
|
||||||
|
|
||||||
|
export default function CountUp({
|
||||||
|
to,
|
||||||
|
from = 0,
|
||||||
|
direction = 'up',
|
||||||
|
delay = 0,
|
||||||
|
duration = 2,
|
||||||
|
className = '',
|
||||||
|
startWhen = true,
|
||||||
|
separator = '',
|
||||||
|
onStart,
|
||||||
|
onEnd
|
||||||
|
}: CountUpProps) {
|
||||||
|
const ref = useRef<HTMLSpanElement>(null);
|
||||||
|
const motionValue = useMotionValue(direction === 'down' ? to : from);
|
||||||
|
|
||||||
|
const damping = 20 + 40 * (1 / duration);
|
||||||
|
const stiffness = 100 * (1 / duration);
|
||||||
|
|
||||||
|
const springValue = useSpring(motionValue, {
|
||||||
|
damping,
|
||||||
|
stiffness
|
||||||
|
});
|
||||||
|
|
||||||
|
const isInView = useInView(ref, { once: true, margin: '0px' });
|
||||||
|
const reduceMotion = useReducedMotion();
|
||||||
|
|
||||||
|
const getDecimalPlaces = (num: number): number => {
|
||||||
|
const str = num.toString();
|
||||||
|
if (str.includes('.')) {
|
||||||
|
const decimals = str.split('.')[1];
|
||||||
|
if (parseInt(decimals) !== 0) {
|
||||||
|
return decimals.length;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
};
|
||||||
|
|
||||||
|
const maxDecimals = Math.max(getDecimalPlaces(from), getDecimalPlaces(to));
|
||||||
|
|
||||||
|
const formatValue = useCallback(
|
||||||
|
(latest: number) => {
|
||||||
|
const hasDecimals = maxDecimals > 0;
|
||||||
|
|
||||||
|
const options: Intl.NumberFormatOptions = {
|
||||||
|
useGrouping: !!separator,
|
||||||
|
minimumFractionDigits: hasDecimals ? maxDecimals : 0,
|
||||||
|
maximumFractionDigits: hasDecimals ? maxDecimals : 0
|
||||||
|
};
|
||||||
|
|
||||||
|
const formattedNumber = Intl.NumberFormat('en-US', options).format(latest);
|
||||||
|
|
||||||
|
return separator ? formattedNumber.replace(/,/g, separator) : formattedNumber;
|
||||||
|
},
|
||||||
|
[maxDecimals, separator]
|
||||||
|
);
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
if (ref.current && !reduceMotion) {
|
||||||
|
ref.current.textContent = formatValue(direction === 'down' ? to : from);
|
||||||
|
}
|
||||||
|
}, [from, to, direction, formatValue, reduceMotion]);
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
if (isInView && startWhen && !reduceMotion) {
|
||||||
|
if (typeof onStart === 'function') {
|
||||||
|
onStart();
|
||||||
|
}
|
||||||
|
|
||||||
|
const timeoutId = setTimeout(() => {
|
||||||
|
motionValue.set(direction === 'down' ? from : to);
|
||||||
|
}, delay * 1000);
|
||||||
|
|
||||||
|
const durationTimeoutId = setTimeout(
|
||||||
|
() => {
|
||||||
|
if (typeof onEnd === 'function') {
|
||||||
|
onEnd();
|
||||||
|
}
|
||||||
|
},
|
||||||
|
delay * 1000 + duration * 1000
|
||||||
|
);
|
||||||
|
|
||||||
|
return () => {
|
||||||
|
clearTimeout(timeoutId);
|
||||||
|
clearTimeout(durationTimeoutId);
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}, [isInView, startWhen, reduceMotion, motionValue, direction, from, to, delay, onStart, onEnd, duration]);
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
const unsubscribe = springValue.on('change', (latest: number) => {
|
||||||
|
if (ref.current) {
|
||||||
|
ref.current.textContent = formatValue(latest);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
return () => unsubscribe();
|
||||||
|
}, [springValue, formatValue]);
|
||||||
|
|
||||||
|
// Render the final value on the server so it's readable before hydration and without JS.
|
||||||
|
return (
|
||||||
|
<span className={className} ref={ref} suppressHydrationWarning>
|
||||||
|
{formatValue(direction === 'down' ? from : to)}
|
||||||
|
</span>
|
||||||
|
);
|
||||||
|
}
|
||||||
@@ -0,0 +1,6 @@
|
|||||||
|
.faulty-terminal-container {
|
||||||
|
width: 100%;
|
||||||
|
height: 100%;
|
||||||
|
position: relative;
|
||||||
|
overflow: hidden;
|
||||||
|
}
|
||||||
@@ -0,0 +1,439 @@
|
|||||||
|
// FaultyTerminal — from React Bits (https://github.com/DavidHDev/react-bits)
|
||||||
|
// Copyright (c) 2026 David Haz. MIT + Commons Clause. Adapted for yoyos.sh.
|
||||||
|
'use client';
|
||||||
|
|
||||||
|
import { Renderer, Program, Mesh, Color, Triangle } from 'ogl';
|
||||||
|
import React, { useEffect, useRef, useMemo, useCallback } from 'react';
|
||||||
|
import './FaultyTerminal.css';
|
||||||
|
|
||||||
|
type Vec2 = [number, number];
|
||||||
|
|
||||||
|
export interface FaultyTerminalProps extends React.HTMLAttributes<HTMLDivElement> {
|
||||||
|
scale?: number;
|
||||||
|
gridMul?: Vec2;
|
||||||
|
digitSize?: number;
|
||||||
|
timeScale?: number;
|
||||||
|
pause?: boolean;
|
||||||
|
scanlineIntensity?: number;
|
||||||
|
glitchAmount?: number;
|
||||||
|
flickerAmount?: number;
|
||||||
|
noiseAmp?: number;
|
||||||
|
chromaticAberration?: number;
|
||||||
|
dither?: number | boolean;
|
||||||
|
curvature?: number;
|
||||||
|
tint?: string;
|
||||||
|
mouseReact?: boolean;
|
||||||
|
mouseStrength?: number;
|
||||||
|
dpr?: number;
|
||||||
|
pageLoadAnimation?: boolean;
|
||||||
|
brightness?: number;
|
||||||
|
lightMode?: boolean;
|
||||||
|
}
|
||||||
|
|
||||||
|
const vertexShader = `
|
||||||
|
attribute vec2 position;
|
||||||
|
attribute vec2 uv;
|
||||||
|
varying vec2 vUv;
|
||||||
|
void main() {
|
||||||
|
vUv = uv;
|
||||||
|
gl_Position = vec4(position, 0.0, 1.0);
|
||||||
|
}
|
||||||
|
`;
|
||||||
|
|
||||||
|
const fragmentShader = `
|
||||||
|
precision mediump float;
|
||||||
|
|
||||||
|
varying vec2 vUv;
|
||||||
|
|
||||||
|
uniform float iTime;
|
||||||
|
uniform vec3 iResolution;
|
||||||
|
uniform float uScale;
|
||||||
|
|
||||||
|
uniform vec2 uGridMul;
|
||||||
|
uniform float uDigitSize;
|
||||||
|
uniform float uScanlineIntensity;
|
||||||
|
uniform float uGlitchAmount;
|
||||||
|
uniform float uFlickerAmount;
|
||||||
|
uniform float uNoiseAmp;
|
||||||
|
uniform float uChromaticAberration;
|
||||||
|
uniform float uDither;
|
||||||
|
uniform float uCurvature;
|
||||||
|
uniform vec3 uTint;
|
||||||
|
uniform vec2 uMouse;
|
||||||
|
uniform float uMouseStrength;
|
||||||
|
uniform float uUseMouse;
|
||||||
|
uniform float uPageLoadProgress;
|
||||||
|
uniform float uUsePageLoadAnimation;
|
||||||
|
uniform float uBrightness;
|
||||||
|
uniform float uLightMode;
|
||||||
|
|
||||||
|
float time;
|
||||||
|
|
||||||
|
float hash21(vec2 p){
|
||||||
|
p = fract(p * 234.56);
|
||||||
|
p += dot(p, p + 34.56);
|
||||||
|
return fract(p.x * p.y);
|
||||||
|
}
|
||||||
|
|
||||||
|
float noise(vec2 p)
|
||||||
|
{
|
||||||
|
return sin(p.x * 10.0) * sin(p.y * (3.0 + sin(time * 0.090909))) + 0.2;
|
||||||
|
}
|
||||||
|
|
||||||
|
mat2 rotate(float angle)
|
||||||
|
{
|
||||||
|
float c = cos(angle);
|
||||||
|
float s = sin(angle);
|
||||||
|
return mat2(c, -s, s, c);
|
||||||
|
}
|
||||||
|
|
||||||
|
float fbm(vec2 p)
|
||||||
|
{
|
||||||
|
p *= 1.1;
|
||||||
|
float f = 0.0;
|
||||||
|
float amp = 0.5 * uNoiseAmp;
|
||||||
|
|
||||||
|
mat2 modify0 = rotate(time * 0.02);
|
||||||
|
f += amp * noise(p);
|
||||||
|
p = modify0 * p * 2.0;
|
||||||
|
amp *= 0.454545;
|
||||||
|
|
||||||
|
mat2 modify1 = rotate(time * 0.02);
|
||||||
|
f += amp * noise(p);
|
||||||
|
p = modify1 * p * 2.0;
|
||||||
|
amp *= 0.454545;
|
||||||
|
|
||||||
|
mat2 modify2 = rotate(time * 0.08);
|
||||||
|
f += amp * noise(p);
|
||||||
|
|
||||||
|
return f;
|
||||||
|
}
|
||||||
|
|
||||||
|
float pattern(vec2 p, out vec2 q, out vec2 r) {
|
||||||
|
vec2 offset1 = vec2(1.0);
|
||||||
|
vec2 offset0 = vec2(0.0);
|
||||||
|
mat2 rot01 = rotate(0.1 * time);
|
||||||
|
mat2 rot1 = rotate(0.1);
|
||||||
|
|
||||||
|
q = vec2(fbm(p + offset1), fbm(rot01 * p + offset1));
|
||||||
|
r = vec2(fbm(rot1 * q + offset0), fbm(q + offset0));
|
||||||
|
return fbm(p + r);
|
||||||
|
}
|
||||||
|
|
||||||
|
float digit(vec2 p){
|
||||||
|
vec2 grid = uGridMul * 15.0;
|
||||||
|
vec2 s = floor(p * grid) / grid;
|
||||||
|
p = p * grid;
|
||||||
|
vec2 q, r;
|
||||||
|
float intensity = pattern(s * 0.1, q, r) * 1.3 - 0.03;
|
||||||
|
|
||||||
|
if(uUseMouse > 0.5){
|
||||||
|
vec2 mouseWorld = uMouse * uScale;
|
||||||
|
float distToMouse = distance(s, mouseWorld);
|
||||||
|
float mouseInfluence = exp(-distToMouse * 8.0) * uMouseStrength * 10.0;
|
||||||
|
intensity += mouseInfluence;
|
||||||
|
|
||||||
|
float ripple = sin(distToMouse * 20.0 - iTime * 5.0) * 0.1 * mouseInfluence;
|
||||||
|
intensity += ripple;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(uUsePageLoadAnimation > 0.5){
|
||||||
|
float cellRandom = fract(sin(dot(s, vec2(12.9898, 78.233))) * 43758.5453);
|
||||||
|
float cellDelay = cellRandom * 0.8;
|
||||||
|
float cellProgress = clamp((uPageLoadProgress - cellDelay) / 0.2, 0.0, 1.0);
|
||||||
|
|
||||||
|
float fadeAlpha = smoothstep(0.0, 1.0, cellProgress);
|
||||||
|
intensity *= fadeAlpha;
|
||||||
|
}
|
||||||
|
|
||||||
|
p = fract(p);
|
||||||
|
p *= uDigitSize;
|
||||||
|
|
||||||
|
float px5 = p.x * 5.0;
|
||||||
|
float py5 = (1.0 - p.y) * 5.0;
|
||||||
|
float x = fract(px5);
|
||||||
|
float y = fract(py5);
|
||||||
|
|
||||||
|
float i = floor(py5) - 2.0;
|
||||||
|
float j = floor(px5) - 2.0;
|
||||||
|
float n = i * i + j * j;
|
||||||
|
float f = n * 0.0625;
|
||||||
|
|
||||||
|
float isOn = step(0.1, intensity - f);
|
||||||
|
float brightness = isOn * (0.2 + y * 0.8) * (0.75 + x * 0.25);
|
||||||
|
|
||||||
|
return step(0.0, p.x) * step(p.x, 1.0) * step(0.0, p.y) * step(p.y, 1.0) * brightness;
|
||||||
|
}
|
||||||
|
|
||||||
|
float onOff(float a, float b, float c)
|
||||||
|
{
|
||||||
|
return step(c, sin(iTime + a * cos(iTime * b))) * uFlickerAmount;
|
||||||
|
}
|
||||||
|
|
||||||
|
float displace(vec2 look)
|
||||||
|
{
|
||||||
|
float y = look.y - mod(iTime * 0.25, 1.0);
|
||||||
|
float window = 1.0 / (1.0 + 50.0 * y * y);
|
||||||
|
return sin(look.y * 20.0 + iTime) * 0.0125 * onOff(4.0, 2.0, 0.8) * (1.0 + cos(iTime * 60.0)) * window;
|
||||||
|
}
|
||||||
|
|
||||||
|
vec3 getColor(vec2 p){
|
||||||
|
|
||||||
|
float bar = step(mod(p.y + time * 20.0, 1.0), 0.2) * 0.4 + 1.0;
|
||||||
|
bar *= uScanlineIntensity;
|
||||||
|
|
||||||
|
float displacement = displace(p);
|
||||||
|
p.x += displacement;
|
||||||
|
|
||||||
|
if (uGlitchAmount != 1.0) {
|
||||||
|
float extra = displacement * (uGlitchAmount - 1.0);
|
||||||
|
p.x += extra;
|
||||||
|
}
|
||||||
|
|
||||||
|
float middle = digit(p);
|
||||||
|
|
||||||
|
const float off = 0.002;
|
||||||
|
float sum = digit(p + vec2(-off, -off)) + digit(p + vec2(0.0, -off)) + digit(p + vec2(off, -off)) +
|
||||||
|
digit(p + vec2(-off, 0.0)) + digit(p + vec2(0.0, 0.0)) + digit(p + vec2(off, 0.0)) +
|
||||||
|
digit(p + vec2(-off, off)) + digit(p + vec2(0.0, off)) + digit(p + vec2(off, off));
|
||||||
|
|
||||||
|
vec3 baseColor = vec3(0.9) * middle + sum * 0.1 * vec3(1.0) * bar;
|
||||||
|
return baseColor;
|
||||||
|
}
|
||||||
|
|
||||||
|
vec2 barrel(vec2 uv){
|
||||||
|
vec2 c = uv * 2.0 - 1.0;
|
||||||
|
float r2 = dot(c, c);
|
||||||
|
c *= 1.0 + uCurvature * r2;
|
||||||
|
return c * 0.5 + 0.5;
|
||||||
|
}
|
||||||
|
|
||||||
|
void main() {
|
||||||
|
time = iTime * 0.333333;
|
||||||
|
vec2 uv = vUv;
|
||||||
|
|
||||||
|
if(uCurvature != 0.0){
|
||||||
|
uv = barrel(uv);
|
||||||
|
}
|
||||||
|
|
||||||
|
vec2 p = uv * uScale;
|
||||||
|
vec3 col = getColor(p);
|
||||||
|
|
||||||
|
if(uChromaticAberration != 0.0){
|
||||||
|
vec2 ca = vec2(uChromaticAberration) / iResolution.xy;
|
||||||
|
col.r = getColor(p + ca).r;
|
||||||
|
col.b = getColor(p - ca).b;
|
||||||
|
}
|
||||||
|
|
||||||
|
col *= uTint;
|
||||||
|
col *= uBrightness;
|
||||||
|
|
||||||
|
if(uDither > 0.0){
|
||||||
|
float rnd = hash21(gl_FragCoord.xy);
|
||||||
|
col += (rnd - 0.5) * (uDither * 0.003922);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (uLightMode > 0.5) {
|
||||||
|
float energy = max(max(col.r, col.g), col.b);
|
||||||
|
float coverage = clamp(smoothstep(0.0, 0.72, energy) * 0.9, 0.0, 0.9);
|
||||||
|
vec3 ink = clamp(col * 0.42, 0.0, 0.76);
|
||||||
|
col = mix(vec3(1.0), ink, coverage);
|
||||||
|
}
|
||||||
|
|
||||||
|
gl_FragColor = vec4(col, 1.0);
|
||||||
|
}
|
||||||
|
`;
|
||||||
|
|
||||||
|
function hexToRgb(hex: string): [number, number, number] {
|
||||||
|
let h = hex.replace('#', '').trim();
|
||||||
|
if (h.length === 3)
|
||||||
|
h = h
|
||||||
|
.split('')
|
||||||
|
.map(c => c + c)
|
||||||
|
.join('');
|
||||||
|
const num = parseInt(h.slice(0, 6), 16);
|
||||||
|
return [((num >> 16) & 255) / 255, ((num >> 8) & 255) / 255, (num & 255) / 255];
|
||||||
|
}
|
||||||
|
|
||||||
|
export default function FaultyTerminal({
|
||||||
|
scale = 1,
|
||||||
|
gridMul = [2, 1],
|
||||||
|
digitSize = 1.5,
|
||||||
|
timeScale = 0.3,
|
||||||
|
pause = false,
|
||||||
|
scanlineIntensity = 0.3,
|
||||||
|
glitchAmount = 1,
|
||||||
|
flickerAmount = 1,
|
||||||
|
noiseAmp = 1,
|
||||||
|
chromaticAberration = 0,
|
||||||
|
dither = 0,
|
||||||
|
curvature = 0.2,
|
||||||
|
tint = '#ffffff',
|
||||||
|
mouseReact = true,
|
||||||
|
mouseStrength = 0.2,
|
||||||
|
dpr = Math.min(window.devicePixelRatio || 1, 2),
|
||||||
|
pageLoadAnimation = true,
|
||||||
|
brightness = 1,
|
||||||
|
lightMode = false,
|
||||||
|
className,
|
||||||
|
style,
|
||||||
|
...rest
|
||||||
|
}: FaultyTerminalProps) {
|
||||||
|
const containerRef = useRef<HTMLDivElement>(null);
|
||||||
|
const programRef = useRef<Program>(null);
|
||||||
|
const rendererRef = useRef<Renderer>(null);
|
||||||
|
const mouseRef = useRef({ x: 0.5, y: 0.5 });
|
||||||
|
const smoothMouseRef = useRef({ x: 0.5, y: 0.5 });
|
||||||
|
const frozenTimeRef = useRef(0);
|
||||||
|
const rafRef = useRef<number>(0);
|
||||||
|
const loadAnimationStartRef = useRef<number>(0);
|
||||||
|
const timeOffsetRef = useRef<number>(Math.random() * 100);
|
||||||
|
|
||||||
|
const tintVec = useMemo(() => hexToRgb(tint), [tint]);
|
||||||
|
|
||||||
|
const ditherValue = useMemo(() => (typeof dither === 'boolean' ? (dither ? 1 : 0) : dither), [dither]);
|
||||||
|
|
||||||
|
const handleMouseMove = useCallback((e: MouseEvent) => {
|
||||||
|
const ctn = containerRef.current;
|
||||||
|
if (!ctn) return;
|
||||||
|
const rect = ctn.getBoundingClientRect();
|
||||||
|
const x = (e.clientX - rect.left) / rect.width;
|
||||||
|
const y = 1 - (e.clientY - rect.top) / rect.height;
|
||||||
|
mouseRef.current = { x, y };
|
||||||
|
}, []);
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
const ctn = containerRef.current;
|
||||||
|
if (!ctn) return;
|
||||||
|
|
||||||
|
const renderer = new Renderer({ dpr });
|
||||||
|
rendererRef.current = renderer;
|
||||||
|
const gl = renderer.gl;
|
||||||
|
gl.clearColor(lightMode ? 1 : 0, lightMode ? 1 : 0, lightMode ? 1 : 0, 1);
|
||||||
|
|
||||||
|
const geometry = new Triangle(gl);
|
||||||
|
|
||||||
|
const program = new Program(gl, {
|
||||||
|
vertex: vertexShader,
|
||||||
|
fragment: fragmentShader,
|
||||||
|
uniforms: {
|
||||||
|
iTime: { value: 0 },
|
||||||
|
iResolution: {
|
||||||
|
value: new Color(gl.canvas.width, gl.canvas.height, gl.canvas.width / gl.canvas.height)
|
||||||
|
},
|
||||||
|
uScale: { value: scale },
|
||||||
|
|
||||||
|
uGridMul: { value: new Float32Array(gridMul) },
|
||||||
|
uDigitSize: { value: digitSize },
|
||||||
|
uScanlineIntensity: { value: scanlineIntensity },
|
||||||
|
uGlitchAmount: { value: glitchAmount },
|
||||||
|
uFlickerAmount: { value: flickerAmount },
|
||||||
|
uNoiseAmp: { value: noiseAmp },
|
||||||
|
uChromaticAberration: { value: chromaticAberration },
|
||||||
|
uDither: { value: ditherValue },
|
||||||
|
uCurvature: { value: curvature },
|
||||||
|
uTint: { value: new Color(tintVec[0], tintVec[1], tintVec[2]) },
|
||||||
|
uMouse: {
|
||||||
|
value: new Float32Array([smoothMouseRef.current.x, smoothMouseRef.current.y])
|
||||||
|
},
|
||||||
|
uMouseStrength: { value: mouseStrength },
|
||||||
|
uUseMouse: { value: mouseReact ? 1 : 0 },
|
||||||
|
uPageLoadProgress: { value: pageLoadAnimation ? 0 : 1 },
|
||||||
|
uUsePageLoadAnimation: { value: pageLoadAnimation ? 1 : 0 },
|
||||||
|
uBrightness: { value: brightness },
|
||||||
|
uLightMode: { value: lightMode ? 1 : 0 }
|
||||||
|
}
|
||||||
|
});
|
||||||
|
programRef.current = program;
|
||||||
|
|
||||||
|
const mesh = new Mesh(gl, { geometry, program });
|
||||||
|
|
||||||
|
function resize() {
|
||||||
|
if (!ctn || !renderer) return;
|
||||||
|
renderer.setSize(ctn.offsetWidth, ctn.offsetHeight);
|
||||||
|
program.uniforms.iResolution.value = new Color(
|
||||||
|
gl.canvas.width,
|
||||||
|
gl.canvas.height,
|
||||||
|
gl.canvas.width / gl.canvas.height
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
const resizeObserver = new ResizeObserver(() => resize());
|
||||||
|
resizeObserver.observe(ctn);
|
||||||
|
resize();
|
||||||
|
|
||||||
|
const update = (t: number) => {
|
||||||
|
rafRef.current = requestAnimationFrame(update);
|
||||||
|
|
||||||
|
if (pageLoadAnimation && loadAnimationStartRef.current === 0) {
|
||||||
|
loadAnimationStartRef.current = t;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!pause) {
|
||||||
|
const elapsed = (t * 0.001 + timeOffsetRef.current) * timeScale;
|
||||||
|
program.uniforms.iTime.value = elapsed;
|
||||||
|
frozenTimeRef.current = elapsed;
|
||||||
|
} else {
|
||||||
|
program.uniforms.iTime.value = frozenTimeRef.current;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (pageLoadAnimation && loadAnimationStartRef.current > 0) {
|
||||||
|
const animationDuration = 2000;
|
||||||
|
const animationElapsed = t - loadAnimationStartRef.current;
|
||||||
|
const progress = Math.min(animationElapsed / animationDuration, 1);
|
||||||
|
program.uniforms.uPageLoadProgress.value = progress;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (mouseReact) {
|
||||||
|
const dampingFactor = 0.08;
|
||||||
|
const smoothMouse = smoothMouseRef.current;
|
||||||
|
const mouse = mouseRef.current;
|
||||||
|
smoothMouse.x += (mouse.x - smoothMouse.x) * dampingFactor;
|
||||||
|
smoothMouse.y += (mouse.y - smoothMouse.y) * dampingFactor;
|
||||||
|
|
||||||
|
const mouseUniform = program.uniforms.uMouse.value as Float32Array;
|
||||||
|
mouseUniform[0] = smoothMouse.x;
|
||||||
|
mouseUniform[1] = smoothMouse.y;
|
||||||
|
}
|
||||||
|
|
||||||
|
renderer.render({ scene: mesh });
|
||||||
|
};
|
||||||
|
rafRef.current = requestAnimationFrame(update);
|
||||||
|
ctn.appendChild(gl.canvas);
|
||||||
|
|
||||||
|
if (mouseReact) ctn.addEventListener('mousemove', handleMouseMove);
|
||||||
|
|
||||||
|
return () => {
|
||||||
|
cancelAnimationFrame(rafRef.current);
|
||||||
|
resizeObserver.disconnect();
|
||||||
|
if (mouseReact) ctn.removeEventListener('mousemove', handleMouseMove);
|
||||||
|
if (gl.canvas.parentElement === ctn) ctn.removeChild(gl.canvas);
|
||||||
|
gl.getExtension('WEBGL_lose_context')?.loseContext();
|
||||||
|
loadAnimationStartRef.current = 0;
|
||||||
|
timeOffsetRef.current = Math.random() * 100;
|
||||||
|
};
|
||||||
|
}, [
|
||||||
|
dpr,
|
||||||
|
pause,
|
||||||
|
timeScale,
|
||||||
|
scale,
|
||||||
|
gridMul,
|
||||||
|
digitSize,
|
||||||
|
scanlineIntensity,
|
||||||
|
glitchAmount,
|
||||||
|
flickerAmount,
|
||||||
|
noiseAmp,
|
||||||
|
chromaticAberration,
|
||||||
|
ditherValue,
|
||||||
|
curvature,
|
||||||
|
tintVec,
|
||||||
|
mouseReact,
|
||||||
|
mouseStrength,
|
||||||
|
pageLoadAnimation,
|
||||||
|
brightness,
|
||||||
|
lightMode,
|
||||||
|
handleMouseMove
|
||||||
|
]);
|
||||||
|
|
||||||
|
return <div ref={containerRef} className={`faulty-terminal-container ${className}`} style={style} {...rest} />;
|
||||||
|
}
|
||||||
@@ -0,0 +1,14 @@
|
|||||||
|
.halftone-reveal {
|
||||||
|
position: relative;
|
||||||
|
width: 100%;
|
||||||
|
height: 100%;
|
||||||
|
overflow: hidden;
|
||||||
|
touch-action: none;
|
||||||
|
cursor: crosshair;
|
||||||
|
}
|
||||||
|
|
||||||
|
.halftone-reveal canvas {
|
||||||
|
display: block;
|
||||||
|
width: 100%;
|
||||||
|
height: 100%;
|
||||||
|
}
|
||||||
@@ -0,0 +1,385 @@
|
|||||||
|
// HalftoneReveal — from React Bits (https://github.com/DavidHDev/react-bits)
|
||||||
|
// Copyright (c) 2026 David Haz. MIT + Commons Clause. Adapted for yoyos.sh.
|
||||||
|
'use client';
|
||||||
|
|
||||||
|
import { useRef, useEffect, type CSSProperties } from 'react';
|
||||||
|
import { Renderer, Program, Triangle, Mesh, Texture } from 'ogl';
|
||||||
|
|
||||||
|
import './HalftoneReveal.css';
|
||||||
|
|
||||||
|
const DEFAULT_SRC = 'https://picsum.photos/seed/halftone-reveal/1200/800';
|
||||||
|
|
||||||
|
const hexToRgb = (hex: string): [number, number, number] => {
|
||||||
|
const m = /^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(hex || '');
|
||||||
|
return m ? [parseInt(m[1], 16) / 255, parseInt(m[2], 16) / 255, parseInt(m[3], 16) / 255] : [0, 0, 0];
|
||||||
|
};
|
||||||
|
|
||||||
|
type Mode = 'mono' | 'duotone' | 'color';
|
||||||
|
type Shape = 'circle' | 'square' | 'diamond' | 'line';
|
||||||
|
type Trigger = 'off' | 'hover' | 'always';
|
||||||
|
|
||||||
|
const MODES: Record<Mode, number> = { mono: 0, duotone: 1, color: 2 };
|
||||||
|
const SHAPES: Record<Shape, number> = { circle: 0, square: 1, diamond: 2, line: 3 };
|
||||||
|
const TRIGGERS: Record<Trigger, number> = { off: 0, hover: 1, always: 2 };
|
||||||
|
|
||||||
|
export interface HalftoneRevealProps {
|
||||||
|
src?: string;
|
||||||
|
inkColor?: string;
|
||||||
|
paperColor?: string;
|
||||||
|
mode?: Mode;
|
||||||
|
dotSize?: number;
|
||||||
|
dotDensity?: number;
|
||||||
|
angle?: number;
|
||||||
|
shape?: Shape;
|
||||||
|
contrast?: number;
|
||||||
|
invert?: boolean;
|
||||||
|
revealRadius?: number;
|
||||||
|
edge?: number;
|
||||||
|
follow?: number;
|
||||||
|
idleReveal?: number;
|
||||||
|
trigger?: Trigger;
|
||||||
|
borderRadius?: string;
|
||||||
|
className?: string;
|
||||||
|
style?: CSSProperties;
|
||||||
|
}
|
||||||
|
|
||||||
|
const vertex = `#version 300 es
|
||||||
|
in vec2 position;
|
||||||
|
out vec2 vUv;
|
||||||
|
void main() {
|
||||||
|
vUv = position * 0.5 + 0.5;
|
||||||
|
gl_Position = vec4(position, 0.0, 1.0);
|
||||||
|
}
|
||||||
|
`;
|
||||||
|
|
||||||
|
const fragment = `#version 300 es
|
||||||
|
precision highp float;
|
||||||
|
|
||||||
|
uniform sampler2D tMap;
|
||||||
|
uniform vec2 iResolution;
|
||||||
|
uniform vec2 uImageSize;
|
||||||
|
uniform vec2 uMouse;
|
||||||
|
uniform float uActivity;
|
||||||
|
|
||||||
|
uniform float uDotSize;
|
||||||
|
uniform float uDensity;
|
||||||
|
uniform float uAngle;
|
||||||
|
uniform int uShape;
|
||||||
|
uniform vec3 uInk;
|
||||||
|
uniform vec3 uPaper;
|
||||||
|
uniform int uMode;
|
||||||
|
uniform float uContrast;
|
||||||
|
uniform float uInvert;
|
||||||
|
|
||||||
|
uniform float uRevealRadius;
|
||||||
|
uniform float uEdge;
|
||||||
|
uniform float uIdleReveal;
|
||||||
|
uniform int uTrigger;
|
||||||
|
|
||||||
|
in vec2 vUv;
|
||||||
|
out vec4 fragColor;
|
||||||
|
|
||||||
|
vec2 uAspect() {
|
||||||
|
return vec2(iResolution.x / max(iResolution.y, 1.0), 1.0);
|
||||||
|
}
|
||||||
|
|
||||||
|
vec2 coverUv(vec2 uv) {
|
||||||
|
float ia = uImageSize.x / max(uImageSize.y, 1.0);
|
||||||
|
float pa = iResolution.x / max(iResolution.y, 1.0);
|
||||||
|
vec2 s = pa > ia ? vec2(1.0, ia / pa) : vec2(pa / ia, 1.0);
|
||||||
|
return (uv - 0.5) * s + 0.5;
|
||||||
|
}
|
||||||
|
|
||||||
|
vec3 gradeRGB(vec3 c) {
|
||||||
|
c = clamp((c - 0.5) * uContrast + 0.5, 0.0, 1.0);
|
||||||
|
return mix(c, 1.0 - c, uInvert);
|
||||||
|
}
|
||||||
|
|
||||||
|
float shapeDist(vec2 f) {
|
||||||
|
if (uShape == 1) return max(abs(f.x), abs(f.y));
|
||||||
|
if (uShape == 2) return abs(f.x) + abs(f.y);
|
||||||
|
if (uShape == 3) return abs(f.y);
|
||||||
|
return length(f);
|
||||||
|
}
|
||||||
|
|
||||||
|
mat2 rot(float a) {
|
||||||
|
float c = cos(a);
|
||||||
|
float s = sin(a);
|
||||||
|
return mat2(c, -s, s, c);
|
||||||
|
}
|
||||||
|
|
||||||
|
vec4 sampleCell(vec2 st, float dens, float ang) {
|
||||||
|
vec2 rp = rot(ang) * st * dens;
|
||||||
|
vec2 center = floor(rp) + 0.5;
|
||||||
|
vec2 stC = rot(-ang) * (center / dens);
|
||||||
|
vec2 uvC = stC / uAspect();
|
||||||
|
return texture(tMap, clamp(coverUv(uvC), 0.0, 1.0));
|
||||||
|
}
|
||||||
|
|
||||||
|
float coverage(vec2 st, float dens, float ang, float ink, float rscale) {
|
||||||
|
vec2 rp = rot(ang) * st * dens;
|
||||||
|
vec2 f = fract(rp) - 0.5;
|
||||||
|
float d = shapeDist(f);
|
||||||
|
float r = sqrt(clamp(ink, 0.0, 1.0)) * 0.72 * rscale * uDotSize;
|
||||||
|
float w = length(fwidth(rp)) * 0.6 + 1e-4;
|
||||||
|
return smoothstep(r + w, r - w, d);
|
||||||
|
}
|
||||||
|
|
||||||
|
void main() {
|
||||||
|
vec2 aspect = uAspect();
|
||||||
|
vec2 st = vUv * aspect;
|
||||||
|
float ang = radians(uAngle);
|
||||||
|
|
||||||
|
vec2 duv = (vUv - uMouse) * aspect;
|
||||||
|
float dist = length(duv);
|
||||||
|
|
||||||
|
float act = uTrigger == 2 ? 1.0 : (uTrigger == 0 ? 0.0 : uActivity);
|
||||||
|
float radius = max(uRevealRadius, 1e-4) * mix(0.4, 1.0, act);
|
||||||
|
|
||||||
|
float px = 1.4 / max(iResolution.y, 1.0);
|
||||||
|
float band = max(px, radius * (1.0 - clamp(uEdge, 0.0, 1.0)) * 0.45);
|
||||||
|
float loupe = 1.0 - smoothstep(radius - band, radius + band, dist);
|
||||||
|
float focus = clamp(max(loupe * act, uIdleReveal), 0.0, 1.0);
|
||||||
|
|
||||||
|
float dens = uDensity;
|
||||||
|
|
||||||
|
vec3 print;
|
||||||
|
if (uMode == 2) {
|
||||||
|
vec3 gc = gradeRGB(sampleCell(st, dens, ang + radians(15.0)).rgb);
|
||||||
|
vec3 gm = gradeRGB(sampleCell(st, dens, ang + radians(75.0)).rgb);
|
||||||
|
vec3 gy = gradeRGB(sampleCell(st, dens, ang).rgb);
|
||||||
|
vec3 gk = gradeRGB(sampleCell(st, dens, ang + radians(45.0)).rgb);
|
||||||
|
float c = 1.0 - gc.r;
|
||||||
|
float m = 1.0 - gm.g;
|
||||||
|
float y = 1.0 - gy.b;
|
||||||
|
float k = 1.0 - dot(gk, vec3(0.299, 0.587, 0.114));
|
||||||
|
float gcr = min(min(c, m), y) * 0.5;
|
||||||
|
c = clamp(c - gcr, 0.0, 1.0);
|
||||||
|
m = clamp(m - gcr, 0.0, 1.0);
|
||||||
|
y = clamp(y - gcr, 0.0, 1.0);
|
||||||
|
k = clamp(max(gcr, k * k * 0.9), 0.0, 1.0);
|
||||||
|
float covC = coverage(st, dens, ang + radians(15.0), c, 0.82);
|
||||||
|
float covM = coverage(st, dens, ang + radians(75.0), m, 0.82);
|
||||||
|
float covY = coverage(st, dens, ang, y, 0.82);
|
||||||
|
float covK = coverage(st, dens, ang + radians(45.0), k, 0.78);
|
||||||
|
print = uPaper;
|
||||||
|
print = mix(print, print * vec3(0.10, 0.72, 0.90), covC);
|
||||||
|
print = mix(print, print * vec3(0.92, 0.10, 0.52), covM);
|
||||||
|
print = mix(print, print * vec3(0.98, 0.86, 0.10), covY);
|
||||||
|
print = mix(print, print * vec3(0.08), covK);
|
||||||
|
} else if (uMode == 1) {
|
||||||
|
vec3 ink2 = mix(uInk.gbr, vec3(0.90, 0.24, 0.30), 0.7);
|
||||||
|
float lumA = dot(gradeRGB(sampleCell(st, dens, ang).rgb), vec3(0.299, 0.587, 0.114));
|
||||||
|
float lumB = dot(gradeRGB(sampleCell(st, dens, ang + radians(38.0)).rgb), vec3(0.299, 0.587, 0.114));
|
||||||
|
float covA = coverage(st, dens, ang, 1.0 - lumA, 1.0);
|
||||||
|
float covB = coverage(st, dens, ang + radians(38.0), pow(1.0 - lumB, 1.4), 0.92);
|
||||||
|
print = uPaper;
|
||||||
|
print = mix(print, ink2, covB * 0.85);
|
||||||
|
print = mix(print, uInk, covA);
|
||||||
|
} else {
|
||||||
|
float lum = dot(gradeRGB(sampleCell(st, dens, ang).rgb), vec3(0.299, 0.587, 0.114));
|
||||||
|
float cov = coverage(st, dens, ang, 1.0 - lum, 1.0);
|
||||||
|
print = mix(uPaper, uInk, cov);
|
||||||
|
}
|
||||||
|
|
||||||
|
float t = clamp(dist / radius, 0.0, 1.0);
|
||||||
|
float bend = t * t * t * t;
|
||||||
|
vec2 dir = dist > 1e-5 ? duv / dist : vec2(0.0);
|
||||||
|
vec2 off = dir * bend * radius * 0.22 / aspect;
|
||||||
|
vec2 ca = dir * bend * 0.0045 / aspect;
|
||||||
|
vec3 sharp = gradeRGB(vec3(
|
||||||
|
texture(tMap, clamp(coverUv(vUv - off - ca), 0.0, 1.0)).r,
|
||||||
|
texture(tMap, clamp(coverUv(vUv - off), 0.0, 1.0)).g,
|
||||||
|
texture(tMap, clamp(coverUv(vUv - off + ca), 0.0, 1.0)).b
|
||||||
|
));
|
||||||
|
|
||||||
|
vec3 col = mix(print, sharp, focus);
|
||||||
|
fragColor = vec4(col, 1.0);
|
||||||
|
}
|
||||||
|
`;
|
||||||
|
|
||||||
|
const HalftoneReveal = ({
|
||||||
|
src = DEFAULT_SRC,
|
||||||
|
inkColor = '#141414',
|
||||||
|
paperColor = '#fff7e6',
|
||||||
|
mode = 'mono',
|
||||||
|
dotSize = 1,
|
||||||
|
dotDensity = 71,
|
||||||
|
angle = 45,
|
||||||
|
shape = 'circle',
|
||||||
|
contrast = 1.15,
|
||||||
|
invert = false,
|
||||||
|
revealRadius = 0.4,
|
||||||
|
edge = 0.8,
|
||||||
|
follow = 0.37,
|
||||||
|
idleReveal = 0,
|
||||||
|
trigger = 'hover',
|
||||||
|
borderRadius = '16px',
|
||||||
|
className = '',
|
||||||
|
style
|
||||||
|
}: HalftoneRevealProps) => {
|
||||||
|
const containerRef = useRef<HTMLDivElement>(null);
|
||||||
|
const rendererRef = useRef<Renderer | null>(null);
|
||||||
|
const uniformsRef = useRef<Record<string, { value: unknown }> | null>(null);
|
||||||
|
const rafRef = useRef<number | null>(null);
|
||||||
|
const followRef = useRef<number>(follow);
|
||||||
|
const mouseRef = useRef({ x: 0.5, y: 0.5, sx: 0.5, sy: 0.5, active: 0, target: 0 });
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
followRef.current = follow;
|
||||||
|
}, [follow]);
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
const container = containerRef.current;
|
||||||
|
if (!container) return;
|
||||||
|
|
||||||
|
const reduced =
|
||||||
|
typeof window !== 'undefined' &&
|
||||||
|
window.matchMedia &&
|
||||||
|
window.matchMedia('(prefers-reduced-motion: reduce)').matches;
|
||||||
|
|
||||||
|
const renderer = new Renderer({
|
||||||
|
dpr: Math.min(window.devicePixelRatio || 1, 2),
|
||||||
|
alpha: false,
|
||||||
|
antialias: true
|
||||||
|
});
|
||||||
|
rendererRef.current = renderer;
|
||||||
|
const gl = renderer.gl;
|
||||||
|
gl.clearColor(0, 0, 0, 1);
|
||||||
|
gl.canvas.style.width = '100%';
|
||||||
|
gl.canvas.style.height = '100%';
|
||||||
|
gl.canvas.style.display = 'block';
|
||||||
|
container.appendChild(gl.canvas);
|
||||||
|
|
||||||
|
const texture = new Texture(gl, { generateMipmaps: false });
|
||||||
|
|
||||||
|
const uniforms = {
|
||||||
|
tMap: { value: texture },
|
||||||
|
iResolution: { value: [1, 1] },
|
||||||
|
uImageSize: { value: [1, 1] },
|
||||||
|
uMouse: { value: [0.5, 0.5] },
|
||||||
|
uActivity: { value: 0 },
|
||||||
|
uDotSize: { value: dotSize },
|
||||||
|
uDensity: { value: dotDensity },
|
||||||
|
uAngle: { value: angle },
|
||||||
|
uShape: { value: SHAPES[shape] ?? 0 },
|
||||||
|
uInk: { value: hexToRgb(inkColor) },
|
||||||
|
uPaper: { value: hexToRgb(paperColor) },
|
||||||
|
uMode: { value: MODES[mode] ?? 0 },
|
||||||
|
uContrast: { value: contrast },
|
||||||
|
uInvert: { value: invert ? 1 : 0 },
|
||||||
|
uRevealRadius: { value: revealRadius },
|
||||||
|
uEdge: { value: edge },
|
||||||
|
uIdleReveal: { value: idleReveal },
|
||||||
|
uTrigger: { value: TRIGGERS[trigger] ?? 1 }
|
||||||
|
};
|
||||||
|
uniformsRef.current = uniforms;
|
||||||
|
|
||||||
|
const program = new Program(gl, { vertex, fragment, uniforms });
|
||||||
|
const mesh = new Mesh(gl, { geometry: new Triangle(gl), program });
|
||||||
|
|
||||||
|
const img = new Image();
|
||||||
|
img.crossOrigin = 'anonymous';
|
||||||
|
img.src = src;
|
||||||
|
img.onload = () => {
|
||||||
|
texture.image = img;
|
||||||
|
uniforms.uImageSize.value = [img.naturalWidth, img.naturalHeight];
|
||||||
|
};
|
||||||
|
|
||||||
|
const resize = () => {
|
||||||
|
const w = container.clientWidth || 1;
|
||||||
|
const h = container.clientHeight || 1;
|
||||||
|
renderer.setSize(w, h);
|
||||||
|
uniforms.iResolution.value = [gl.canvas.width, gl.canvas.height];
|
||||||
|
};
|
||||||
|
resize();
|
||||||
|
const ro = new ResizeObserver(resize);
|
||||||
|
ro.observe(container);
|
||||||
|
|
||||||
|
const onMove = (e: PointerEvent) => {
|
||||||
|
const rect = container.getBoundingClientRect();
|
||||||
|
mouseRef.current.x = (e.clientX - rect.left) / rect.width;
|
||||||
|
mouseRef.current.y = 1 - (e.clientY - rect.top) / rect.height;
|
||||||
|
mouseRef.current.target = reduced ? 0 : 1;
|
||||||
|
};
|
||||||
|
const onLeave = () => {
|
||||||
|
mouseRef.current.target = 0;
|
||||||
|
};
|
||||||
|
container.addEventListener('pointermove', onMove, { passive: true });
|
||||||
|
container.addEventListener('pointerenter', onMove, { passive: true });
|
||||||
|
container.addEventListener('pointerleave', onLeave, { passive: true });
|
||||||
|
|
||||||
|
let prev = performance.now();
|
||||||
|
const loop = (now: number) => {
|
||||||
|
rafRef.current = requestAnimationFrame(loop);
|
||||||
|
const dt = Math.min(0.05, Math.max(0.001, (now - prev) / 1000));
|
||||||
|
prev = now;
|
||||||
|
|
||||||
|
const m = mouseRef.current;
|
||||||
|
const a = 1 - Math.exp(-dt / Math.max(0.001, followRef.current));
|
||||||
|
m.sx += (m.x - m.sx) * a;
|
||||||
|
m.sy += (m.y - m.sy) * a;
|
||||||
|
const ba = 1 - Math.exp(-dt / 0.18);
|
||||||
|
m.active += (m.target - m.active) * ba;
|
||||||
|
|
||||||
|
uniforms.uMouse.value[0] = m.sx;
|
||||||
|
uniforms.uMouse.value[1] = m.sy;
|
||||||
|
uniforms.uActivity.value = m.active;
|
||||||
|
|
||||||
|
renderer.render({ scene: mesh });
|
||||||
|
};
|
||||||
|
rafRef.current = requestAnimationFrame(loop);
|
||||||
|
|
||||||
|
return () => {
|
||||||
|
if (rafRef.current) cancelAnimationFrame(rafRef.current);
|
||||||
|
ro.disconnect();
|
||||||
|
container.removeEventListener('pointermove', onMove);
|
||||||
|
container.removeEventListener('pointerenter', onMove);
|
||||||
|
container.removeEventListener('pointerleave', onLeave);
|
||||||
|
const ext = gl.getExtension('WEBGL_lose_context');
|
||||||
|
if (ext) ext.loseContext();
|
||||||
|
if (gl.canvas.parentNode) gl.canvas.parentNode.removeChild(gl.canvas);
|
||||||
|
rendererRef.current = null;
|
||||||
|
uniformsRef.current = null;
|
||||||
|
};
|
||||||
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||||
|
}, [src]);
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
const u = uniformsRef.current;
|
||||||
|
if (!u) return;
|
||||||
|
u.uDotSize.value = dotSize;
|
||||||
|
u.uDensity.value = dotDensity;
|
||||||
|
u.uAngle.value = angle;
|
||||||
|
u.uShape.value = SHAPES[shape] ?? 0;
|
||||||
|
u.uInk.value = hexToRgb(inkColor);
|
||||||
|
u.uPaper.value = hexToRgb(paperColor);
|
||||||
|
u.uMode.value = MODES[mode] ?? 0;
|
||||||
|
u.uContrast.value = contrast;
|
||||||
|
u.uInvert.value = invert ? 1 : 0;
|
||||||
|
u.uRevealRadius.value = revealRadius;
|
||||||
|
u.uEdge.value = edge;
|
||||||
|
u.uIdleReveal.value = idleReveal;
|
||||||
|
u.uTrigger.value = TRIGGERS[trigger] ?? 1;
|
||||||
|
}, [
|
||||||
|
dotSize,
|
||||||
|
dotDensity,
|
||||||
|
angle,
|
||||||
|
shape,
|
||||||
|
inkColor,
|
||||||
|
paperColor,
|
||||||
|
mode,
|
||||||
|
contrast,
|
||||||
|
invert,
|
||||||
|
revealRadius,
|
||||||
|
edge,
|
||||||
|
idleReveal,
|
||||||
|
trigger
|
||||||
|
]);
|
||||||
|
|
||||||
|
return (
|
||||||
|
<div ref={containerRef} className={`halftone-reveal ${className}`.trim()} style={{ borderRadius, ...style }} />
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
export default HalftoneReveal;
|
||||||
@@ -0,0 +1,12 @@
|
|||||||
|
.text-block {
|
||||||
|
margin: 7vw;
|
||||||
|
max-width: 800px;
|
||||||
|
font-family: monospace;
|
||||||
|
font-size: clamp(14px, 4vw, 32px);
|
||||||
|
color: #fff;
|
||||||
|
}
|
||||||
|
|
||||||
|
.char {
|
||||||
|
will-change: transform;
|
||||||
|
display: inline-block;
|
||||||
|
}
|
||||||
@@ -0,0 +1,90 @@
|
|||||||
|
// ScrambledText — from React Bits (https://github.com/DavidHDev/react-bits)
|
||||||
|
// Copyright (c) 2026 David Haz. MIT + Commons Clause. Adapted for yoyos.sh.
|
||||||
|
'use client';
|
||||||
|
|
||||||
|
import React, { useEffect, useRef } from 'react';
|
||||||
|
import { gsap } from 'gsap';
|
||||||
|
import { SplitText } from 'gsap/SplitText';
|
||||||
|
import { ScrambleTextPlugin } from 'gsap/ScrambleTextPlugin';
|
||||||
|
|
||||||
|
import './ScrambledText.css';
|
||||||
|
|
||||||
|
gsap.registerPlugin(SplitText, ScrambleTextPlugin);
|
||||||
|
|
||||||
|
export interface ScrambledTextProps {
|
||||||
|
radius?: number;
|
||||||
|
duration?: number;
|
||||||
|
speed?: number;
|
||||||
|
scrambleChars?: string;
|
||||||
|
className?: string;
|
||||||
|
style?: React.CSSProperties;
|
||||||
|
children: React.ReactNode;
|
||||||
|
}
|
||||||
|
|
||||||
|
const ScrambledText: React.FC<ScrambledTextProps> = ({
|
||||||
|
radius = 100,
|
||||||
|
duration = 1.2,
|
||||||
|
speed = 0.5,
|
||||||
|
scrambleChars = '.:',
|
||||||
|
className = '',
|
||||||
|
style = {},
|
||||||
|
children
|
||||||
|
}) => {
|
||||||
|
const rootRef = useRef<HTMLDivElement | null>(null);
|
||||||
|
const charsRef = useRef<HTMLElement[]>([]);
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
if (!rootRef.current) return;
|
||||||
|
|
||||||
|
const split = SplitText.create(rootRef.current.querySelector('p'), {
|
||||||
|
type: 'chars',
|
||||||
|
charsClass: 'char'
|
||||||
|
});
|
||||||
|
charsRef.current = split.chars as HTMLElement[];
|
||||||
|
|
||||||
|
charsRef.current.forEach(c => {
|
||||||
|
gsap.set(c, {
|
||||||
|
display: 'inline-block',
|
||||||
|
attr: { 'data-content': c.innerHTML }
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
const handleMove = (e: PointerEvent) => {
|
||||||
|
charsRef.current.forEach(c => {
|
||||||
|
const { left, top, width, height } = c.getBoundingClientRect();
|
||||||
|
const dx = e.clientX - (left + width / 2);
|
||||||
|
const dy = e.clientY - (top + height / 2);
|
||||||
|
const dist = Math.hypot(dx, dy);
|
||||||
|
|
||||||
|
if (dist < radius) {
|
||||||
|
gsap.to(c, {
|
||||||
|
overwrite: true,
|
||||||
|
duration: duration * (1 - dist / radius),
|
||||||
|
scrambleText: {
|
||||||
|
text: (c as HTMLElement).dataset.content || '',
|
||||||
|
chars: scrambleChars,
|
||||||
|
speed
|
||||||
|
},
|
||||||
|
ease: 'none'
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
const el = rootRef.current;
|
||||||
|
el.addEventListener('pointermove', handleMove);
|
||||||
|
|
||||||
|
return () => {
|
||||||
|
el.removeEventListener('pointermove', handleMove);
|
||||||
|
split.revert();
|
||||||
|
};
|
||||||
|
}, [radius, duration, speed, scrambleChars]);
|
||||||
|
|
||||||
|
return (
|
||||||
|
<div ref={rootRef} className={`text-block ${className}`} style={style}>
|
||||||
|
<p>{children}</p>
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
export default ScrambledText;
|
||||||
@@ -0,0 +1,26 @@
|
|||||||
|
.parallax {
|
||||||
|
position: relative;
|
||||||
|
overflow: hidden;
|
||||||
|
}
|
||||||
|
|
||||||
|
.scroller {
|
||||||
|
display: flex;
|
||||||
|
white-space: nowrap;
|
||||||
|
text-align: center;
|
||||||
|
font-family: sans-serif;
|
||||||
|
font-size: 2.25rem;
|
||||||
|
font-weight: bold;
|
||||||
|
letter-spacing: -0.02em;
|
||||||
|
filter: drop-shadow(0 1px 1px rgba(0, 0, 0, 0.1));
|
||||||
|
}
|
||||||
|
|
||||||
|
.scroller span {
|
||||||
|
flex-shrink: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
@media (min-width: 768px) {
|
||||||
|
.scroller {
|
||||||
|
font-size: 5rem;
|
||||||
|
line-height: 5rem;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,182 @@
|
|||||||
|
// ScrollVelocity — from React Bits (https://github.com/DavidHDev/react-bits)
|
||||||
|
// Copyright (c) 2026 David Haz. MIT + Commons Clause. Adapted for yoyos.sh.
|
||||||
|
'use client';
|
||||||
|
|
||||||
|
import React, { useRef, useLayoutEffect, useState } from 'react';
|
||||||
|
import {
|
||||||
|
motion,
|
||||||
|
useScroll,
|
||||||
|
useSpring,
|
||||||
|
useTransform,
|
||||||
|
useMotionValue,
|
||||||
|
useVelocity,
|
||||||
|
useAnimationFrame
|
||||||
|
} from 'motion/react';
|
||||||
|
import './ScrollVelocity.css';
|
||||||
|
|
||||||
|
interface VelocityMapping {
|
||||||
|
input: [number, number];
|
||||||
|
output: [number, number];
|
||||||
|
}
|
||||||
|
|
||||||
|
interface VelocityTextProps {
|
||||||
|
children: React.ReactNode;
|
||||||
|
baseVelocity: number;
|
||||||
|
scrollContainerRef?: React.RefObject<HTMLElement>;
|
||||||
|
className?: string;
|
||||||
|
damping?: number;
|
||||||
|
stiffness?: number;
|
||||||
|
numCopies?: number;
|
||||||
|
velocityMapping?: VelocityMapping;
|
||||||
|
parallaxClassName?: string;
|
||||||
|
scrollerClassName?: string;
|
||||||
|
parallaxStyle?: React.CSSProperties;
|
||||||
|
scrollerStyle?: React.CSSProperties;
|
||||||
|
}
|
||||||
|
|
||||||
|
interface ScrollVelocityProps {
|
||||||
|
scrollContainerRef?: React.RefObject<HTMLElement>;
|
||||||
|
texts: React.ReactNode[];
|
||||||
|
velocity?: number;
|
||||||
|
className?: string;
|
||||||
|
damping?: number;
|
||||||
|
stiffness?: number;
|
||||||
|
numCopies?: number;
|
||||||
|
velocityMapping?: VelocityMapping;
|
||||||
|
parallaxClassName?: string;
|
||||||
|
scrollerClassName?: string;
|
||||||
|
parallaxStyle?: React.CSSProperties;
|
||||||
|
scrollerStyle?: React.CSSProperties;
|
||||||
|
}
|
||||||
|
|
||||||
|
function useElementWidth<T extends HTMLElement>(ref: React.RefObject<T | null>): number {
|
||||||
|
const [width, setWidth] = useState(0);
|
||||||
|
|
||||||
|
useLayoutEffect(() => {
|
||||||
|
function updateWidth() {
|
||||||
|
if (ref.current) {
|
||||||
|
setWidth(ref.current.offsetWidth);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
updateWidth();
|
||||||
|
window.addEventListener('resize', updateWidth);
|
||||||
|
return () => window.removeEventListener('resize', updateWidth);
|
||||||
|
}, [ref]);
|
||||||
|
|
||||||
|
return width;
|
||||||
|
}
|
||||||
|
|
||||||
|
export const ScrollVelocity: React.FC<ScrollVelocityProps> = ({
|
||||||
|
scrollContainerRef,
|
||||||
|
texts = [],
|
||||||
|
velocity = 100,
|
||||||
|
className = '',
|
||||||
|
damping = 50,
|
||||||
|
stiffness = 400,
|
||||||
|
numCopies = 6,
|
||||||
|
velocityMapping = { input: [0, 1000], output: [0, 5] },
|
||||||
|
parallaxClassName = 'parallax',
|
||||||
|
scrollerClassName = 'scroller',
|
||||||
|
parallaxStyle,
|
||||||
|
scrollerStyle
|
||||||
|
}) => {
|
||||||
|
function VelocityText({
|
||||||
|
children,
|
||||||
|
baseVelocity = velocity,
|
||||||
|
scrollContainerRef,
|
||||||
|
className = '',
|
||||||
|
damping,
|
||||||
|
stiffness,
|
||||||
|
numCopies,
|
||||||
|
velocityMapping,
|
||||||
|
parallaxClassName,
|
||||||
|
scrollerClassName,
|
||||||
|
parallaxStyle,
|
||||||
|
scrollerStyle
|
||||||
|
}: VelocityTextProps) {
|
||||||
|
const baseX = useMotionValue(0);
|
||||||
|
const scrollOptions = scrollContainerRef ? { container: scrollContainerRef } : {};
|
||||||
|
const { scrollY } = useScroll(scrollOptions);
|
||||||
|
const scrollVelocity = useVelocity(scrollY);
|
||||||
|
const smoothVelocity = useSpring(scrollVelocity, {
|
||||||
|
damping: damping ?? 50,
|
||||||
|
stiffness: stiffness ?? 400
|
||||||
|
});
|
||||||
|
const velocityFactor = useTransform(
|
||||||
|
smoothVelocity,
|
||||||
|
velocityMapping?.input || [0, 1000],
|
||||||
|
velocityMapping?.output || [0, 5],
|
||||||
|
{ clamp: false }
|
||||||
|
);
|
||||||
|
|
||||||
|
const copyRef = useRef<HTMLSpanElement>(null);
|
||||||
|
const copyWidth = useElementWidth(copyRef);
|
||||||
|
|
||||||
|
function wrap(min: number, max: number, v: number): number {
|
||||||
|
const range = max - min;
|
||||||
|
const mod = (((v - min) % range) + range) % range;
|
||||||
|
return mod + min;
|
||||||
|
}
|
||||||
|
|
||||||
|
const x = useTransform(baseX, v => {
|
||||||
|
if (copyWidth === 0) return '0px';
|
||||||
|
return `${wrap(-copyWidth, 0, v)}px`;
|
||||||
|
});
|
||||||
|
|
||||||
|
const directionFactor = useRef<number>(1);
|
||||||
|
useAnimationFrame((t, delta) => {
|
||||||
|
let moveBy = directionFactor.current * baseVelocity * (delta / 1000);
|
||||||
|
|
||||||
|
if (velocityFactor.get() < 0) {
|
||||||
|
directionFactor.current = -1;
|
||||||
|
} else if (velocityFactor.get() > 0) {
|
||||||
|
directionFactor.current = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
moveBy += directionFactor.current * moveBy * velocityFactor.get();
|
||||||
|
baseX.set(baseX.get() + moveBy);
|
||||||
|
});
|
||||||
|
|
||||||
|
const spans = [];
|
||||||
|
for (let i = 0; i < (numCopies ?? 6); i++) {
|
||||||
|
spans.push(
|
||||||
|
<span className={className} key={i} ref={i === 0 ? copyRef : null}>
|
||||||
|
{children}
|
||||||
|
</span>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
return (
|
||||||
|
<div className={parallaxClassName} style={parallaxStyle}>
|
||||||
|
<motion.div className={scrollerClassName} style={{ x, ...scrollerStyle }}>
|
||||||
|
{spans}
|
||||||
|
</motion.div>
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
return (
|
||||||
|
<section>
|
||||||
|
{texts.map((text, index) => (
|
||||||
|
<VelocityText
|
||||||
|
key={index}
|
||||||
|
className={className}
|
||||||
|
baseVelocity={index % 2 !== 0 ? -velocity : velocity}
|
||||||
|
scrollContainerRef={scrollContainerRef}
|
||||||
|
damping={damping}
|
||||||
|
stiffness={stiffness}
|
||||||
|
numCopies={numCopies}
|
||||||
|
velocityMapping={velocityMapping}
|
||||||
|
parallaxClassName={parallaxClassName}
|
||||||
|
scrollerClassName={scrollerClassName}
|
||||||
|
parallaxStyle={parallaxStyle}
|
||||||
|
scrollerStyle={scrollerStyle}
|
||||||
|
>
|
||||||
|
{text}
|
||||||
|
</VelocityText>
|
||||||
|
))}
|
||||||
|
</section>
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
export default ScrollVelocity;
|
||||||
@@ -0,0 +1,170 @@
|
|||||||
|
.split-flap-text {
|
||||||
|
display: inline-flex;
|
||||||
|
align-items: center;
|
||||||
|
gap: var(--split-flap-gap, 6px);
|
||||||
|
color: var(--split-flap-text-color, #f8fafc);
|
||||||
|
font-family: 'SFMono-Regular', 'Roboto Mono', 'Cascadia Code', 'Liberation Mono', Menlo, monospace;
|
||||||
|
font-size: var(--split-flap-font-size, 52px);
|
||||||
|
font-weight: 760;
|
||||||
|
line-height: 1;
|
||||||
|
letter-spacing: 0.035em;
|
||||||
|
white-space: pre;
|
||||||
|
user-select: none;
|
||||||
|
font-variant-numeric: tabular-nums;
|
||||||
|
}
|
||||||
|
|
||||||
|
.split-flap-text__tile {
|
||||||
|
position: relative;
|
||||||
|
width: 0.78em;
|
||||||
|
height: 1.08em;
|
||||||
|
overflow: hidden;
|
||||||
|
border-radius: var(--split-flap-radius, 8px);
|
||||||
|
background:
|
||||||
|
radial-gradient(circle at 50% 0%, rgba(255, 255, 255, 0.16), transparent 44%),
|
||||||
|
linear-gradient(
|
||||||
|
180deg,
|
||||||
|
color-mix(in srgb, var(--split-flap-tile-color, #111827) 82%, white),
|
||||||
|
var(--split-flap-tile-color, #111827)
|
||||||
|
);
|
||||||
|
box-shadow:
|
||||||
|
0 0.035em 0.08em rgba(255, 255, 255, 0.08) inset,
|
||||||
|
0 -0.05em 0.1em rgba(0, 0, 0, 0.38) inset,
|
||||||
|
0 0.16em 0.38em rgba(0, 0, 0, 0.28);
|
||||||
|
perspective: 520px;
|
||||||
|
transform-style: preserve-3d;
|
||||||
|
isolation: isolate;
|
||||||
|
}
|
||||||
|
|
||||||
|
.split-flap-text__tile::before {
|
||||||
|
content: '';
|
||||||
|
position: absolute;
|
||||||
|
z-index: 8;
|
||||||
|
top: calc(50% - 0.5px);
|
||||||
|
left: 0;
|
||||||
|
width: 100%;
|
||||||
|
height: 1px;
|
||||||
|
background: linear-gradient(
|
||||||
|
90deg,
|
||||||
|
transparent,
|
||||||
|
rgba(255, 255, 255, 0.18) 18%,
|
||||||
|
rgba(0, 0, 0, 0.64) 50%,
|
||||||
|
rgba(255, 255, 255, 0.14) 82%,
|
||||||
|
transparent
|
||||||
|
);
|
||||||
|
box-shadow:
|
||||||
|
0 -1px 0 rgba(255, 255, 255, 0.08),
|
||||||
|
0 1px 0 rgba(0, 0, 0, 0.5);
|
||||||
|
pointer-events: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
.split-flap-text__tile::after {
|
||||||
|
content: '';
|
||||||
|
position: absolute;
|
||||||
|
inset: 0;
|
||||||
|
z-index: 9;
|
||||||
|
border: 1px solid rgba(255, 255, 255, 0.08);
|
||||||
|
border-radius: inherit;
|
||||||
|
box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.2) inset;
|
||||||
|
pointer-events: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
.split-flap-text__half,
|
||||||
|
.split-flap-text__flap {
|
||||||
|
position: absolute;
|
||||||
|
left: 0;
|
||||||
|
width: 100%;
|
||||||
|
height: 50%;
|
||||||
|
overflow: hidden;
|
||||||
|
background:
|
||||||
|
linear-gradient(180deg, rgba(255, 255, 255, 0.07), transparent 34%), var(--split-flap-tile-color, #111827);
|
||||||
|
backface-visibility: hidden;
|
||||||
|
}
|
||||||
|
|
||||||
|
.split-flap-text__half--top,
|
||||||
|
.split-flap-text__flap--front {
|
||||||
|
top: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.split-flap-text__half--bottom,
|
||||||
|
.split-flap-text__flap--back {
|
||||||
|
bottom: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.split-flap-text__half--bottom,
|
||||||
|
.split-flap-text__flap--back {
|
||||||
|
background:
|
||||||
|
linear-gradient(0deg, rgba(255, 255, 255, 0.06), transparent 38%),
|
||||||
|
color-mix(in srgb, var(--split-flap-tile-color, #111827) 92%, black);
|
||||||
|
}
|
||||||
|
|
||||||
|
.split-flap-text__char {
|
||||||
|
position: absolute;
|
||||||
|
left: 0;
|
||||||
|
width: 100%;
|
||||||
|
height: 200%;
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
color: var(--split-flap-text-color, #f8fafc);
|
||||||
|
text-shadow:
|
||||||
|
0 0.025em 0 rgba(255, 255, 255, 0.16),
|
||||||
|
0 0.09em 0.16em rgba(0, 0, 0, 0.42);
|
||||||
|
}
|
||||||
|
|
||||||
|
.split-flap-text__half--top .split-flap-text__char,
|
||||||
|
.split-flap-text__flap--front .split-flap-text__char {
|
||||||
|
top: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.split-flap-text__half--bottom .split-flap-text__char,
|
||||||
|
.split-flap-text__flap--back .split-flap-text__char {
|
||||||
|
bottom: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.split-flap-text__flap {
|
||||||
|
z-index: 6;
|
||||||
|
will-change: transform, filter;
|
||||||
|
transform-style: preserve-3d;
|
||||||
|
}
|
||||||
|
|
||||||
|
.split-flap-text__flap--front {
|
||||||
|
transform-origin: center bottom;
|
||||||
|
animation: split-flap-front var(--split-flap-flip-duration, 0.12s) cubic-bezier(0.23, 1, 0.32, 1) both;
|
||||||
|
}
|
||||||
|
|
||||||
|
.split-flap-text__flap--back {
|
||||||
|
transform-origin: center top;
|
||||||
|
transform: rotateX(90deg);
|
||||||
|
animation: split-flap-back var(--split-flap-flip-duration, 0.12s) cubic-bezier(0.23, 1, 0.32, 1) both;
|
||||||
|
}
|
||||||
|
|
||||||
|
@keyframes split-flap-front {
|
||||||
|
0% {
|
||||||
|
transform: rotateX(0deg);
|
||||||
|
filter: brightness(1.08);
|
||||||
|
}
|
||||||
|
|
||||||
|
100% {
|
||||||
|
transform: rotateX(-90deg);
|
||||||
|
filter: brightness(0.52);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@keyframes split-flap-back {
|
||||||
|
0%,
|
||||||
|
45% {
|
||||||
|
transform: rotateX(90deg);
|
||||||
|
filter: brightness(0.58);
|
||||||
|
}
|
||||||
|
|
||||||
|
100% {
|
||||||
|
transform: rotateX(0deg);
|
||||||
|
filter: brightness(1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@media (prefers-reduced-motion: reduce) {
|
||||||
|
.split-flap-text__flap {
|
||||||
|
animation: none !important;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,355 @@
|
|||||||
|
// SplitFlapText — from React Bits (https://github.com/DavidHDev/react-bits)
|
||||||
|
// Copyright (c) 2026 David Haz. MIT + Commons Clause. Adapted for yoyos.sh.
|
||||||
|
'use client';
|
||||||
|
|
||||||
|
import { type CSSProperties, type HTMLAttributes, useEffect, useMemo, useRef, useState } from 'react';
|
||||||
|
import './SplitFlapText.css';
|
||||||
|
|
||||||
|
type TileState = {
|
||||||
|
current: string;
|
||||||
|
next: string;
|
||||||
|
flipping: boolean;
|
||||||
|
tick: number;
|
||||||
|
};
|
||||||
|
|
||||||
|
type AnimationPlan = {
|
||||||
|
index: number;
|
||||||
|
from: string;
|
||||||
|
target: string;
|
||||||
|
sequence: string[];
|
||||||
|
start: number;
|
||||||
|
step: number;
|
||||||
|
done: boolean;
|
||||||
|
};
|
||||||
|
|
||||||
|
type TileUpdate = {
|
||||||
|
index: number;
|
||||||
|
current: string;
|
||||||
|
next: string;
|
||||||
|
done: boolean;
|
||||||
|
};
|
||||||
|
|
||||||
|
export interface SplitFlapTextProps extends HTMLAttributes<HTMLDivElement> {
|
||||||
|
words?: string[];
|
||||||
|
text?: string;
|
||||||
|
flipDuration?: number;
|
||||||
|
stagger?: number;
|
||||||
|
cycleDelay?: number;
|
||||||
|
charset?: 'alpha' | 'alphanumeric' | 'numeric' | (string & {});
|
||||||
|
flipsPerChar?: number;
|
||||||
|
tileColor?: string;
|
||||||
|
textColor?: string;
|
||||||
|
tileRadius?: number | string;
|
||||||
|
gap?: number | string;
|
||||||
|
fontSize?: number | string;
|
||||||
|
loop?: boolean;
|
||||||
|
padTo?: number;
|
||||||
|
}
|
||||||
|
|
||||||
|
const DEFAULT_WORDS = ['LAUNCH READY', 'SYNC ONLINE', 'SIGNAL LIVE'];
|
||||||
|
|
||||||
|
const CHARSETS: Record<string, string> = {
|
||||||
|
alpha: 'ABCDEFGHIJKLMNOPQRSTUVWXYZ',
|
||||||
|
alphanumeric: 'ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789',
|
||||||
|
numeric: '0123456789'
|
||||||
|
};
|
||||||
|
|
||||||
|
const toCssUnit = (value: number | string) => (typeof value === 'number' ? `${value}px` : value);
|
||||||
|
|
||||||
|
const resolveCharset = (charset: SplitFlapTextProps['charset']) => {
|
||||||
|
if (charset && CHARSETS[charset]) return CHARSETS[charset];
|
||||||
|
return typeof charset === 'string' && charset.length > 0 ? charset : CHARSETS.alphanumeric;
|
||||||
|
};
|
||||||
|
|
||||||
|
const normalizePhrase = (phrase: string, width: number) => {
|
||||||
|
const safe = String(phrase ?? '');
|
||||||
|
return safe.padEnd(width, ' ').slice(0, width);
|
||||||
|
};
|
||||||
|
|
||||||
|
const createTiles = (phrase: string): TileState[] =>
|
||||||
|
phrase.split('').map(char => ({
|
||||||
|
current: char,
|
||||||
|
next: char,
|
||||||
|
flipping: false,
|
||||||
|
tick: 0
|
||||||
|
}));
|
||||||
|
|
||||||
|
const sampleChar = (charset: string) => charset.charAt(Math.floor(Math.random() * charset.length)) || ' ';
|
||||||
|
|
||||||
|
const buildSequence = (target: string, flips: number, charset: string) => {
|
||||||
|
const steps: string[] = [];
|
||||||
|
for (let i = 0; i < flips; i += 1) {
|
||||||
|
steps.push(sampleChar(charset));
|
||||||
|
}
|
||||||
|
steps.push(target);
|
||||||
|
return steps;
|
||||||
|
};
|
||||||
|
|
||||||
|
const usePrefersReducedMotion = () => {
|
||||||
|
const [prefersReduced, setPrefersReduced] = useState(false);
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
if (typeof window === 'undefined' || !window.matchMedia) return;
|
||||||
|
|
||||||
|
const mediaQuery = window.matchMedia('(prefers-reduced-motion: reduce)');
|
||||||
|
const handleChange = () => setPrefersReduced(mediaQuery.matches);
|
||||||
|
|
||||||
|
handleChange();
|
||||||
|
mediaQuery.addEventListener('change', handleChange);
|
||||||
|
|
||||||
|
return () => mediaQuery.removeEventListener('change', handleChange);
|
||||||
|
}, []);
|
||||||
|
|
||||||
|
return prefersReduced;
|
||||||
|
};
|
||||||
|
|
||||||
|
const SplitFlapText = ({
|
||||||
|
words = ['LAUNCH READY', 'SYNC ONLINE', 'SIGNAL LIVE'],
|
||||||
|
text,
|
||||||
|
flipDuration = 0.12,
|
||||||
|
stagger = 0.06,
|
||||||
|
cycleDelay = 2400,
|
||||||
|
charset = 'alphanumeric',
|
||||||
|
flipsPerChar = 8,
|
||||||
|
tileColor = '#111827',
|
||||||
|
textColor = '#f8fafc',
|
||||||
|
tileRadius = 8,
|
||||||
|
gap = 6,
|
||||||
|
fontSize = 52,
|
||||||
|
loop = true,
|
||||||
|
padTo = 12,
|
||||||
|
className = '',
|
||||||
|
style = {},
|
||||||
|
...props
|
||||||
|
}: SplitFlapTextProps) => {
|
||||||
|
const prefersReducedMotion = usePrefersReducedMotion();
|
||||||
|
const rafRef = useRef<number | null>(null);
|
||||||
|
const cycleTimerRef = useRef<number | null>(null);
|
||||||
|
const currentTextRef = useRef('');
|
||||||
|
|
||||||
|
const sourceWords = Array.isArray(words) && words.length > 0 ? words : DEFAULT_WORDS;
|
||||||
|
const phrasesKey = typeof text === 'string' ? text : sourceWords.map(word => String(word ?? '')).join('\u001f');
|
||||||
|
const phrases = useMemo(() => phrasesKey.split('\u001f'), [phrasesKey]);
|
||||||
|
|
||||||
|
const width = useMemo(() => {
|
||||||
|
const longest = phrases.reduce((max, phrase) => Math.max(max, phrase.length), 1);
|
||||||
|
return Math.max(1, Math.ceil(Number(padTo) || 0), longest);
|
||||||
|
}, [padTo, phrases]);
|
||||||
|
|
||||||
|
const normalizedPhrases = useMemo(() => phrases.map(phrase => normalizePhrase(phrase, width)), [phrases, width]);
|
||||||
|
|
||||||
|
const [tiles, setTiles] = useState<TileState[]>(() => createTiles(normalizedPhrases[0] || ''));
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
const clearAnimation = () => {
|
||||||
|
if (rafRef.current) {
|
||||||
|
cancelAnimationFrame(rafRef.current);
|
||||||
|
rafRef.current = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (cycleTimerRef.current) {
|
||||||
|
clearTimeout(cycleTimerRef.current);
|
||||||
|
cycleTimerRef.current = null;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
clearAnimation();
|
||||||
|
|
||||||
|
const firstPhrase = normalizedPhrases[0] || '';
|
||||||
|
currentTextRef.current = firstPhrase;
|
||||||
|
setTiles(createTiles(firstPhrase));
|
||||||
|
|
||||||
|
if (normalizedPhrases.length <= 1 || typeof window === 'undefined') {
|
||||||
|
return clearAnimation;
|
||||||
|
}
|
||||||
|
|
||||||
|
let phraseIndex = 0;
|
||||||
|
let cancelled = false;
|
||||||
|
|
||||||
|
const safeFlipMs = Math.max(40, (Number(flipDuration) || 0.12) * 1000);
|
||||||
|
const safeStaggerMs = Math.max(0, (Number(stagger) || 0) * 1000);
|
||||||
|
const safeCycleDelay = Math.max(400, Number(cycleDelay) || 2400);
|
||||||
|
const safeFlips = Math.max(0, Math.floor(Number(flipsPerChar) || 0));
|
||||||
|
const activeCharset = resolveCharset(charset);
|
||||||
|
|
||||||
|
const animateTo = (targetPhrase: string) => {
|
||||||
|
if (prefersReducedMotion) {
|
||||||
|
currentTextRef.current = targetPhrase;
|
||||||
|
setTiles(createTiles(targetPhrase));
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
const fromPhrase = normalizePhrase(currentTextRef.current, width);
|
||||||
|
const targetChars = targetPhrase.split('');
|
||||||
|
|
||||||
|
const plans = targetChars
|
||||||
|
.map<AnimationPlan | null>((targetChar, index) => {
|
||||||
|
const fromChar = fromPhrase[index] || ' ';
|
||||||
|
if (fromChar === targetChar) return null;
|
||||||
|
|
||||||
|
return {
|
||||||
|
index,
|
||||||
|
from: fromChar,
|
||||||
|
target: targetChar,
|
||||||
|
sequence: buildSequence(targetChar, safeFlips, activeCharset),
|
||||||
|
start: index * safeStaggerMs,
|
||||||
|
step: -1,
|
||||||
|
done: false
|
||||||
|
};
|
||||||
|
})
|
||||||
|
.filter((plan): plan is AnimationPlan => plan !== null);
|
||||||
|
|
||||||
|
if (!plans.length) {
|
||||||
|
currentTextRef.current = targetPhrase;
|
||||||
|
setTiles(createTiles(targetPhrase));
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
const totalDuration = plans.reduce(
|
||||||
|
(max, plan) => Math.max(max, plan.start + plan.sequence.length * safeFlipMs),
|
||||||
|
0
|
||||||
|
);
|
||||||
|
const startedAt = performance.now();
|
||||||
|
|
||||||
|
const updateTiles = (updates: TileUpdate[]) => {
|
||||||
|
setTiles(previous => {
|
||||||
|
const nextTiles = [...previous];
|
||||||
|
updates.forEach(update => {
|
||||||
|
const tile = nextTiles[update.index];
|
||||||
|
if (!tile) return;
|
||||||
|
|
||||||
|
nextTiles[update.index] = {
|
||||||
|
current: update.current,
|
||||||
|
next: update.next,
|
||||||
|
flipping: !update.done,
|
||||||
|
tick: tile.tick + 1
|
||||||
|
};
|
||||||
|
});
|
||||||
|
return nextTiles;
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
const tick = (now: number) => {
|
||||||
|
if (cancelled) return;
|
||||||
|
|
||||||
|
const elapsed = now - startedAt;
|
||||||
|
const updates: TileUpdate[] = [];
|
||||||
|
let shouldContinue = false;
|
||||||
|
|
||||||
|
plans.forEach(plan => {
|
||||||
|
const localElapsed = elapsed - plan.start;
|
||||||
|
|
||||||
|
if (localElapsed < 0) {
|
||||||
|
shouldContinue = true;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
const step = Math.floor(localElapsed / safeFlipMs);
|
||||||
|
|
||||||
|
if (step < plan.sequence.length) {
|
||||||
|
shouldContinue = true;
|
||||||
|
|
||||||
|
if (step !== plan.step) {
|
||||||
|
plan.step = step;
|
||||||
|
updates.push({
|
||||||
|
index: plan.index,
|
||||||
|
current: step === 0 ? plan.from : plan.sequence[step - 1],
|
||||||
|
next: plan.sequence[step],
|
||||||
|
done: false
|
||||||
|
});
|
||||||
|
}
|
||||||
|
} else if (!plan.done) {
|
||||||
|
plan.done = true;
|
||||||
|
updates.push({
|
||||||
|
index: plan.index,
|
||||||
|
current: plan.target,
|
||||||
|
next: plan.target,
|
||||||
|
done: true
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
if (updates.length > 0) updateTiles(updates);
|
||||||
|
|
||||||
|
if (shouldContinue) {
|
||||||
|
rafRef.current = requestAnimationFrame(tick);
|
||||||
|
} else {
|
||||||
|
currentTextRef.current = targetPhrase;
|
||||||
|
rafRef.current = null;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
rafRef.current = requestAnimationFrame(tick);
|
||||||
|
return totalDuration;
|
||||||
|
};
|
||||||
|
|
||||||
|
const scheduleNext = (delay: number) => {
|
||||||
|
cycleTimerRef.current = window.setTimeout(() => {
|
||||||
|
if (cancelled) return;
|
||||||
|
|
||||||
|
const nextIndex = phraseIndex + 1;
|
||||||
|
|
||||||
|
if (nextIndex >= normalizedPhrases.length && !loop) return;
|
||||||
|
|
||||||
|
phraseIndex = nextIndex % normalizedPhrases.length;
|
||||||
|
const animationDuration = animateTo(normalizedPhrases[phraseIndex]);
|
||||||
|
scheduleNext(safeCycleDelay + animationDuration);
|
||||||
|
}, delay);
|
||||||
|
};
|
||||||
|
|
||||||
|
scheduleNext(safeCycleDelay);
|
||||||
|
|
||||||
|
return () => {
|
||||||
|
cancelled = true;
|
||||||
|
clearAnimation();
|
||||||
|
};
|
||||||
|
}, [normalizedPhrases, width, loop, cycleDelay, flipDuration, stagger, flipsPerChar, charset, prefersReducedMotion]);
|
||||||
|
|
||||||
|
const settledText = tiles
|
||||||
|
.map(tile => tile.current)
|
||||||
|
.join('')
|
||||||
|
.trimEnd();
|
||||||
|
const componentStyle: CSSProperties & Record<string, string | number | undefined> = {
|
||||||
|
'--split-flap-tile-color': tileColor,
|
||||||
|
'--split-flap-text-color': textColor,
|
||||||
|
'--split-flap-radius': toCssUnit(tileRadius),
|
||||||
|
'--split-flap-gap': toCssUnit(gap),
|
||||||
|
'--split-flap-font-size': toCssUnit(fontSize),
|
||||||
|
'--split-flap-flip-duration': `${Math.max(0.04, Number(flipDuration) || 0.12)}s`,
|
||||||
|
...style
|
||||||
|
};
|
||||||
|
|
||||||
|
return (
|
||||||
|
<div
|
||||||
|
className={`split-flap-text ${className}`.trim()}
|
||||||
|
style={componentStyle}
|
||||||
|
role="text"
|
||||||
|
aria-label={settledText || undefined}
|
||||||
|
{...props}
|
||||||
|
>
|
||||||
|
{tiles.map((tile, index) => (
|
||||||
|
<span className="split-flap-text__tile" aria-hidden="true" key={`${index}-${tiles.length}`}>
|
||||||
|
<span className="split-flap-text__half split-flap-text__half--top">
|
||||||
|
<span className="split-flap-text__char">{tile.current === ' ' ? '\u00A0' : tile.current}</span>
|
||||||
|
</span>
|
||||||
|
<span className="split-flap-text__half split-flap-text__half--bottom">
|
||||||
|
<span className="split-flap-text__char">{tile.flipping ? tile.next : tile.current}</span>
|
||||||
|
</span>
|
||||||
|
|
||||||
|
{tile.flipping && (
|
||||||
|
<>
|
||||||
|
<span className="split-flap-text__flap split-flap-text__flap--front" key={`front-${index}-${tile.tick}`}>
|
||||||
|
<span className="split-flap-text__char">{tile.current === ' ' ? '\u00A0' : tile.current}</span>
|
||||||
|
</span>
|
||||||
|
<span className="split-flap-text__flap split-flap-text__flap--back" key={`back-${index}-${tile.tick}`}>
|
||||||
|
<span className="split-flap-text__char">{tile.next === ' ' ? '\u00A0' : tile.next}</span>
|
||||||
|
</span>
|
||||||
|
</>
|
||||||
|
)}
|
||||||
|
</span>
|
||||||
|
))}
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
export default SplitFlapText;
|
||||||
@@ -0,0 +1,356 @@
|
|||||||
|
.staggered-menu-wrapper {
|
||||||
|
position: relative;
|
||||||
|
width: 100%;
|
||||||
|
height: 100%;
|
||||||
|
z-index: 40;
|
||||||
|
pointer-events: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
.staggered-menu-wrapper.fixed-wrapper {
|
||||||
|
position: fixed;
|
||||||
|
top: 0;
|
||||||
|
left: 0;
|
||||||
|
width: 100vw;
|
||||||
|
height: 100vh;
|
||||||
|
z-index: 40;
|
||||||
|
overflow: hidden;
|
||||||
|
}
|
||||||
|
|
||||||
|
.staggered-menu-header {
|
||||||
|
position: absolute;
|
||||||
|
top: 0;
|
||||||
|
left: 0;
|
||||||
|
width: 100%;
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: space-between;
|
||||||
|
padding: 2em;
|
||||||
|
background: transparent;
|
||||||
|
pointer-events: none;
|
||||||
|
z-index: 20;
|
||||||
|
}
|
||||||
|
|
||||||
|
.staggered-menu-header > * {
|
||||||
|
pointer-events: auto;
|
||||||
|
}
|
||||||
|
|
||||||
|
.sm-logo {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
user-select: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
.sm-logo-img {
|
||||||
|
display: block;
|
||||||
|
height: 32px;
|
||||||
|
width: auto;
|
||||||
|
object-fit: contain;
|
||||||
|
}
|
||||||
|
|
||||||
|
.sm-toggle {
|
||||||
|
position: relative;
|
||||||
|
display: inline-flex;
|
||||||
|
align-items: center;
|
||||||
|
gap: 0.3rem;
|
||||||
|
background: transparent;
|
||||||
|
border: none;
|
||||||
|
cursor: pointer;
|
||||||
|
color: #e9e9ef;
|
||||||
|
font-weight: 500;
|
||||||
|
line-height: 1;
|
||||||
|
overflow: visible;
|
||||||
|
}
|
||||||
|
|
||||||
|
.sm-toggle:focus-visible {
|
||||||
|
outline: 2px solid #ffffffaa;
|
||||||
|
outline-offset: 4px;
|
||||||
|
border-radius: 4px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.sm-line:last-of-type {
|
||||||
|
margin-top: 6px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.sm-toggle-textWrap {
|
||||||
|
position: relative;
|
||||||
|
display: inline-block;
|
||||||
|
height: 1em;
|
||||||
|
overflow: hidden;
|
||||||
|
white-space: nowrap;
|
||||||
|
width: var(--sm-toggle-width, auto);
|
||||||
|
min-width: var(--sm-toggle-width, auto);
|
||||||
|
}
|
||||||
|
|
||||||
|
.sm-toggle-textInner {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
line-height: 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
.sm-toggle-line {
|
||||||
|
display: block;
|
||||||
|
height: 1em;
|
||||||
|
line-height: 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
.sm-icon {
|
||||||
|
position: relative;
|
||||||
|
width: 14px;
|
||||||
|
height: 14px;
|
||||||
|
flex: 0 0 14px;
|
||||||
|
display: inline-flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
will-change: transform;
|
||||||
|
}
|
||||||
|
|
||||||
|
.sm-panel-itemWrap {
|
||||||
|
position: relative;
|
||||||
|
overflow: hidden;
|
||||||
|
line-height: 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
.sm-icon-line {
|
||||||
|
position: absolute;
|
||||||
|
left: 50%;
|
||||||
|
top: 50%;
|
||||||
|
width: 100%;
|
||||||
|
height: 2px;
|
||||||
|
background: currentColor;
|
||||||
|
border-radius: 2px;
|
||||||
|
transform: translate(-50%, -50%);
|
||||||
|
will-change: transform;
|
||||||
|
}
|
||||||
|
|
||||||
|
.sm-line {
|
||||||
|
display: none !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
.staggered-menu-panel {
|
||||||
|
position: absolute;
|
||||||
|
top: 0;
|
||||||
|
right: 0;
|
||||||
|
width: clamp(260px, 38vw, 420px);
|
||||||
|
height: 100%;
|
||||||
|
background: white;
|
||||||
|
backdrop-filter: blur(12px);
|
||||||
|
-webkit-backdrop-filter: blur(12px);
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
padding: 6em 2em 2em 2em;
|
||||||
|
overflow-y: auto;
|
||||||
|
z-index: 10;
|
||||||
|
pointer-events: auto;
|
||||||
|
opacity: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
[data-position='left'] .staggered-menu-panel {
|
||||||
|
right: auto;
|
||||||
|
left: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.sm-prelayers {
|
||||||
|
position: absolute;
|
||||||
|
top: 0;
|
||||||
|
right: 0;
|
||||||
|
bottom: 0;
|
||||||
|
width: clamp(260px, 38vw, 420px);
|
||||||
|
pointer-events: none;
|
||||||
|
z-index: 5;
|
||||||
|
opacity: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
[data-position='left'] .sm-prelayers {
|
||||||
|
right: auto;
|
||||||
|
left: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.sm-prelayer {
|
||||||
|
position: absolute;
|
||||||
|
top: 0;
|
||||||
|
right: 0;
|
||||||
|
height: 100%;
|
||||||
|
width: 100%;
|
||||||
|
transform: translateX(0);
|
||||||
|
opacity: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.sm-panel-inner {
|
||||||
|
flex: 1;
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
gap: 1.25rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.sm-socials {
|
||||||
|
margin-top: auto;
|
||||||
|
padding-top: 2rem;
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
gap: 0.75rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.sm-socials-title {
|
||||||
|
margin: 0;
|
||||||
|
font-size: 1rem;
|
||||||
|
font-weight: 500;
|
||||||
|
color: var(--sm-accent, #ff0000);
|
||||||
|
}
|
||||||
|
|
||||||
|
.sm-socials-list {
|
||||||
|
list-style: none;
|
||||||
|
margin: 0;
|
||||||
|
padding: 0;
|
||||||
|
display: flex;
|
||||||
|
flex-direction: row;
|
||||||
|
align-items: center;
|
||||||
|
gap: 1rem;
|
||||||
|
flex-wrap: wrap;
|
||||||
|
}
|
||||||
|
|
||||||
|
.sm-socials-list .sm-socials-link {
|
||||||
|
opacity: 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
.sm-socials-list:hover .sm-socials-link {
|
||||||
|
opacity: 0.35;
|
||||||
|
}
|
||||||
|
|
||||||
|
.sm-socials-list:hover .sm-socials-link:hover {
|
||||||
|
opacity: 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
.sm-socials-link:focus-visible {
|
||||||
|
outline: 2px solid var(--sm-accent, #ff0000);
|
||||||
|
outline-offset: 3px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.sm-socials-list:focus-within .sm-socials-link {
|
||||||
|
opacity: 0.35;
|
||||||
|
}
|
||||||
|
|
||||||
|
.sm-socials-list:focus-within .sm-socials-link:focus-visible {
|
||||||
|
opacity: 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
.sm-socials-link {
|
||||||
|
font-size: 1.2rem;
|
||||||
|
font-weight: 500;
|
||||||
|
color: #111;
|
||||||
|
text-decoration: none;
|
||||||
|
position: relative;
|
||||||
|
padding: 2px 0;
|
||||||
|
display: inline-block;
|
||||||
|
transition:
|
||||||
|
color 0.3s ease,
|
||||||
|
opacity 0.3s ease;
|
||||||
|
}
|
||||||
|
|
||||||
|
.sm-socials-link:hover {
|
||||||
|
color: var(--sm-accent, #ff0000);
|
||||||
|
}
|
||||||
|
|
||||||
|
.sm-panel-title {
|
||||||
|
margin: 0;
|
||||||
|
font-size: 1rem;
|
||||||
|
font-weight: 600;
|
||||||
|
color: #fff;
|
||||||
|
text-transform: uppercase;
|
||||||
|
}
|
||||||
|
|
||||||
|
.sm-panel-list {
|
||||||
|
list-style: none;
|
||||||
|
margin: 0;
|
||||||
|
padding: 0;
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
gap: 0.5rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.sm-panel-item {
|
||||||
|
position: relative;
|
||||||
|
color: #000;
|
||||||
|
font-weight: 600;
|
||||||
|
font-size: 4rem;
|
||||||
|
cursor: pointer;
|
||||||
|
line-height: 1;
|
||||||
|
letter-spacing: -2px;
|
||||||
|
text-transform: uppercase;
|
||||||
|
transition:
|
||||||
|
background 0.25s,
|
||||||
|
color 0.25s;
|
||||||
|
display: inline-block;
|
||||||
|
text-decoration: none;
|
||||||
|
padding-right: 1.4em;
|
||||||
|
}
|
||||||
|
|
||||||
|
.staggered-menu-panel .sm-socials-list .sm-socials-link {
|
||||||
|
opacity: 1;
|
||||||
|
transition: opacity 0.3s ease;
|
||||||
|
}
|
||||||
|
|
||||||
|
.staggered-menu-panel .sm-socials-list:hover .sm-socials-link:not(:hover) {
|
||||||
|
opacity: 0.35;
|
||||||
|
}
|
||||||
|
|
||||||
|
.staggered-menu-panel .sm-socials-list:focus-within .sm-socials-link:not(:focus-visible) {
|
||||||
|
opacity: 0.35;
|
||||||
|
}
|
||||||
|
|
||||||
|
.staggered-menu-panel .sm-socials-list .sm-socials-link:hover,
|
||||||
|
.staggered-menu-panel .sm-socials-list .sm-socials-link:focus-visible {
|
||||||
|
opacity: 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
.sm-panel-itemLabel {
|
||||||
|
display: inline-block;
|
||||||
|
will-change: transform;
|
||||||
|
transform-origin: 50% 100%;
|
||||||
|
}
|
||||||
|
|
||||||
|
.sm-panel-item:hover {
|
||||||
|
color: var(--sm-accent, #5227ff);
|
||||||
|
}
|
||||||
|
|
||||||
|
.sm-panel-list[data-numbering] {
|
||||||
|
counter-reset: smItem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.sm-panel-list[data-numbering] .sm-panel-item::after {
|
||||||
|
counter-increment: smItem;
|
||||||
|
content: counter(smItem, decimal-leading-zero);
|
||||||
|
position: absolute;
|
||||||
|
top: 0.1em;
|
||||||
|
right: 3.2em;
|
||||||
|
font-size: 18px;
|
||||||
|
font-weight: 400;
|
||||||
|
color: var(--sm-accent, #5227ff);
|
||||||
|
letter-spacing: 0;
|
||||||
|
pointer-events: none;
|
||||||
|
user-select: none;
|
||||||
|
opacity: var(--sm-num-opacity, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
@media (max-width: 1024px) {
|
||||||
|
.staggered-menu-panel {
|
||||||
|
width: 100%;
|
||||||
|
left: 0;
|
||||||
|
right: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.staggered-menu-wrapper[data-open] .sm-logo-img {
|
||||||
|
filter: invert(100%);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@media (max-width: 640px) {
|
||||||
|
.staggered-menu-panel {
|
||||||
|
width: 100%;
|
||||||
|
left: 0;
|
||||||
|
right: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.staggered-menu-wrapper[data-open] .sm-logo-img {
|
||||||
|
filter: invert(100%);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,498 @@
|
|||||||
|
// StaggeredMenu — from React Bits (https://github.com/DavidHDev/react-bits)
|
||||||
|
// Copyright (c) 2026 David Haz. MIT + Commons Clause. Adapted for yoyos.sh.
|
||||||
|
|
||||||
|
import React, { useCallback, useLayoutEffect, useRef, useState } from 'react';
|
||||||
|
import { gsap } from 'gsap';
|
||||||
|
import './StaggeredMenu.css';
|
||||||
|
|
||||||
|
export interface StaggeredMenuItem {
|
||||||
|
label: string;
|
||||||
|
ariaLabel: string;
|
||||||
|
link: string;
|
||||||
|
color?: string;
|
||||||
|
current?: boolean;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface StaggeredMenuSocialItem {
|
||||||
|
label: string;
|
||||||
|
link: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface StaggeredMenuProps {
|
||||||
|
position?: 'left' | 'right';
|
||||||
|
colors?: string[];
|
||||||
|
items?: StaggeredMenuItem[];
|
||||||
|
socialItems?: StaggeredMenuSocialItem[];
|
||||||
|
displaySocials?: boolean;
|
||||||
|
displayItemNumbering?: boolean;
|
||||||
|
className?: string;
|
||||||
|
logoUrl?: string;
|
||||||
|
menuButtonColor?: string;
|
||||||
|
openMenuButtonColor?: string;
|
||||||
|
accentColor?: string;
|
||||||
|
changeMenuColorOnOpen?: boolean;
|
||||||
|
closeOnClickAway?: boolean;
|
||||||
|
onMenuOpen?: () => void;
|
||||||
|
onMenuClose?: () => void;
|
||||||
|
isFixed?: boolean;
|
||||||
|
footer?: React.ReactNode;
|
||||||
|
}
|
||||||
|
|
||||||
|
export const StaggeredMenu: React.FC<StaggeredMenuProps> = ({
|
||||||
|
position = 'right',
|
||||||
|
colors = ['#B497CF', '#5227FF'],
|
||||||
|
items = [],
|
||||||
|
socialItems = [],
|
||||||
|
displaySocials = true,
|
||||||
|
displayItemNumbering = true,
|
||||||
|
className,
|
||||||
|
logoUrl = '',
|
||||||
|
menuButtonColor = '#fff',
|
||||||
|
openMenuButtonColor = '#fff',
|
||||||
|
changeMenuColorOnOpen = true,
|
||||||
|
accentColor = '#5227FF',
|
||||||
|
isFixed = false,
|
||||||
|
closeOnClickAway = true,
|
||||||
|
onMenuOpen,
|
||||||
|
onMenuClose,
|
||||||
|
footer
|
||||||
|
}: StaggeredMenuProps) => {
|
||||||
|
const [open, setOpen] = useState(false);
|
||||||
|
const openRef = useRef(false);
|
||||||
|
const panelRef = useRef<HTMLDivElement | null>(null);
|
||||||
|
const preLayersRef = useRef<HTMLDivElement | null>(null);
|
||||||
|
const preLayerElsRef = useRef<HTMLElement[]>([]);
|
||||||
|
const plusHRef = useRef<HTMLSpanElement | null>(null);
|
||||||
|
const plusVRef = useRef<HTMLSpanElement | null>(null);
|
||||||
|
const iconRef = useRef<HTMLSpanElement | null>(null);
|
||||||
|
const textInnerRef = useRef<HTMLSpanElement | null>(null);
|
||||||
|
const textWrapRef = useRef<HTMLSpanElement | null>(null);
|
||||||
|
const [textLines, setTextLines] = useState<string[]>(['Menu', 'Close']);
|
||||||
|
|
||||||
|
const openTlRef = useRef<gsap.core.Timeline | null>(null);
|
||||||
|
const closeTweenRef = useRef<gsap.core.Tween | null>(null);
|
||||||
|
const spinTweenRef = useRef<gsap.core.Tween | null>(null);
|
||||||
|
const textCycleAnimRef = useRef<gsap.core.Tween | null>(null);
|
||||||
|
const colorTweenRef = useRef<gsap.core.Tween | null>(null);
|
||||||
|
const toggleBtnRef = useRef<HTMLButtonElement | null>(null);
|
||||||
|
const busyRef = useRef(false);
|
||||||
|
const itemEntranceTweenRef = useRef<gsap.core.Tween | null>(null);
|
||||||
|
|
||||||
|
useLayoutEffect(() => {
|
||||||
|
const ctx = gsap.context(() => {
|
||||||
|
const panel = panelRef.current;
|
||||||
|
const preContainer = preLayersRef.current;
|
||||||
|
const plusH = plusHRef.current;
|
||||||
|
const plusV = plusVRef.current;
|
||||||
|
const icon = iconRef.current;
|
||||||
|
const textInner = textInnerRef.current;
|
||||||
|
if (!panel || !plusH || !plusV || !icon || !textInner) return;
|
||||||
|
|
||||||
|
let preLayers: HTMLElement[] = [];
|
||||||
|
if (preContainer) {
|
||||||
|
preLayers = Array.from(preContainer.querySelectorAll('.sm-prelayer')) as HTMLElement[];
|
||||||
|
}
|
||||||
|
preLayerElsRef.current = preLayers;
|
||||||
|
|
||||||
|
const offscreen = position === 'left' ? -100 : 100;
|
||||||
|
gsap.set([panel, ...preLayers], { xPercent: offscreen, opacity: 1 });
|
||||||
|
if (preContainer) {
|
||||||
|
gsap.set(preContainer, { xPercent: 0, opacity: 1 });
|
||||||
|
}
|
||||||
|
gsap.set(plusH, { transformOrigin: '50% 50%', rotate: 0 });
|
||||||
|
gsap.set(plusV, { transformOrigin: '50% 50%', rotate: 90 });
|
||||||
|
gsap.set(icon, { rotate: 0, transformOrigin: '50% 50%' });
|
||||||
|
gsap.set(textInner, { yPercent: 0 });
|
||||||
|
if (toggleBtnRef.current) gsap.set(toggleBtnRef.current, { color: menuButtonColor });
|
||||||
|
});
|
||||||
|
return () => ctx.revert();
|
||||||
|
}, [menuButtonColor, position]);
|
||||||
|
|
||||||
|
const buildOpenTimeline = useCallback(() => {
|
||||||
|
const panel = panelRef.current;
|
||||||
|
const layers = preLayerElsRef.current;
|
||||||
|
if (!panel) return null;
|
||||||
|
|
||||||
|
openTlRef.current?.kill();
|
||||||
|
if (closeTweenRef.current) {
|
||||||
|
closeTweenRef.current.kill();
|
||||||
|
closeTweenRef.current = null;
|
||||||
|
}
|
||||||
|
itemEntranceTweenRef.current?.kill();
|
||||||
|
|
||||||
|
const itemEls = Array.from(panel.querySelectorAll('.sm-panel-itemLabel')) as HTMLElement[];
|
||||||
|
const numberEls = Array.from(
|
||||||
|
panel.querySelectorAll('.sm-panel-list[data-numbering] .sm-panel-item')
|
||||||
|
) as HTMLElement[];
|
||||||
|
const socialTitle = panel.querySelector('.sm-socials-title') as HTMLElement | null;
|
||||||
|
const socialLinks = Array.from(panel.querySelectorAll('.sm-socials-link')) as HTMLElement[];
|
||||||
|
|
||||||
|
const offscreen = position === 'left' ? -100 : 100;
|
||||||
|
const layerStates = layers.map(el => ({ el, start: offscreen }));
|
||||||
|
const panelStart = offscreen;
|
||||||
|
|
||||||
|
if (itemEls.length) {
|
||||||
|
gsap.set(itemEls, { yPercent: 140, rotate: 10 });
|
||||||
|
}
|
||||||
|
if (numberEls.length) {
|
||||||
|
gsap.set(numberEls, { '--sm-num-opacity': 0 });
|
||||||
|
}
|
||||||
|
if (socialTitle) {
|
||||||
|
gsap.set(socialTitle, { opacity: 0 });
|
||||||
|
}
|
||||||
|
if (socialLinks.length) {
|
||||||
|
gsap.set(socialLinks, { y: 25, opacity: 0 });
|
||||||
|
}
|
||||||
|
|
||||||
|
const tl = gsap.timeline({ paused: true });
|
||||||
|
|
||||||
|
layerStates.forEach((ls, i) => {
|
||||||
|
tl.fromTo(ls.el, { xPercent: ls.start }, { xPercent: 0, duration: 0.5, ease: 'power4.out' }, i * 0.07);
|
||||||
|
});
|
||||||
|
const lastTime = layerStates.length ? (layerStates.length - 1) * 0.07 : 0;
|
||||||
|
const panelInsertTime = lastTime + (layerStates.length ? 0.08 : 0);
|
||||||
|
const panelDuration = 0.65;
|
||||||
|
tl.fromTo(
|
||||||
|
panel,
|
||||||
|
{ xPercent: panelStart },
|
||||||
|
{ xPercent: 0, duration: panelDuration, ease: 'power4.out' },
|
||||||
|
panelInsertTime
|
||||||
|
);
|
||||||
|
|
||||||
|
if (itemEls.length) {
|
||||||
|
const itemsStartRatio = 0.15;
|
||||||
|
const itemsStart = panelInsertTime + panelDuration * itemsStartRatio;
|
||||||
|
tl.to(
|
||||||
|
itemEls,
|
||||||
|
{
|
||||||
|
yPercent: 0,
|
||||||
|
rotate: 0,
|
||||||
|
duration: 1,
|
||||||
|
ease: 'power4.out',
|
||||||
|
stagger: { each: 0.1, from: 'start' }
|
||||||
|
},
|
||||||
|
itemsStart
|
||||||
|
);
|
||||||
|
if (numberEls.length) {
|
||||||
|
tl.to(
|
||||||
|
numberEls,
|
||||||
|
{
|
||||||
|
duration: 0.6,
|
||||||
|
ease: 'power2.out',
|
||||||
|
'--sm-num-opacity': 1,
|
||||||
|
stagger: { each: 0.08, from: 'start' }
|
||||||
|
},
|
||||||
|
itemsStart + 0.1
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (socialTitle || socialLinks.length) {
|
||||||
|
const socialsStart = panelInsertTime + panelDuration * 0.4;
|
||||||
|
if (socialTitle) {
|
||||||
|
tl.to(
|
||||||
|
socialTitle,
|
||||||
|
{
|
||||||
|
opacity: 1,
|
||||||
|
duration: 0.5,
|
||||||
|
ease: 'power2.out'
|
||||||
|
},
|
||||||
|
socialsStart
|
||||||
|
);
|
||||||
|
}
|
||||||
|
if (socialLinks.length) {
|
||||||
|
tl.to(
|
||||||
|
socialLinks,
|
||||||
|
{
|
||||||
|
y: 0,
|
||||||
|
opacity: 1,
|
||||||
|
duration: 0.55,
|
||||||
|
ease: 'power3.out',
|
||||||
|
stagger: { each: 0.08, from: 'start' },
|
||||||
|
onComplete: () => {
|
||||||
|
gsap.set(socialLinks, { clearProps: 'opacity' });
|
||||||
|
}
|
||||||
|
},
|
||||||
|
socialsStart + 0.04
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
openTlRef.current = tl;
|
||||||
|
return tl;
|
||||||
|
}, [position]);
|
||||||
|
|
||||||
|
const playOpen = useCallback(() => {
|
||||||
|
if (busyRef.current) return;
|
||||||
|
busyRef.current = true;
|
||||||
|
const tl = buildOpenTimeline();
|
||||||
|
if (tl) {
|
||||||
|
tl.eventCallback('onComplete', () => {
|
||||||
|
busyRef.current = false;
|
||||||
|
});
|
||||||
|
tl.play(0);
|
||||||
|
} else {
|
||||||
|
busyRef.current = false;
|
||||||
|
}
|
||||||
|
}, [buildOpenTimeline]);
|
||||||
|
|
||||||
|
const playClose = useCallback(() => {
|
||||||
|
openTlRef.current?.kill();
|
||||||
|
openTlRef.current = null;
|
||||||
|
itemEntranceTweenRef.current?.kill();
|
||||||
|
|
||||||
|
const panel = panelRef.current;
|
||||||
|
const layers = preLayerElsRef.current;
|
||||||
|
if (!panel) return;
|
||||||
|
|
||||||
|
const all: HTMLElement[] = [...layers, panel];
|
||||||
|
closeTweenRef.current?.kill();
|
||||||
|
const offscreen = position === 'left' ? -100 : 100;
|
||||||
|
closeTweenRef.current = gsap.to(all, {
|
||||||
|
xPercent: offscreen,
|
||||||
|
duration: 0.32,
|
||||||
|
ease: 'power3.in',
|
||||||
|
overwrite: 'auto',
|
||||||
|
onComplete: () => {
|
||||||
|
const itemEls = Array.from(panel.querySelectorAll('.sm-panel-itemLabel')) as HTMLElement[];
|
||||||
|
if (itemEls.length) {
|
||||||
|
gsap.set(itemEls, { yPercent: 140, rotate: 10 });
|
||||||
|
}
|
||||||
|
const numberEls = Array.from(
|
||||||
|
panel.querySelectorAll('.sm-panel-list[data-numbering] .sm-panel-item')
|
||||||
|
) as HTMLElement[];
|
||||||
|
if (numberEls.length) {
|
||||||
|
gsap.set(numberEls, { '--sm-num-opacity': 0 });
|
||||||
|
}
|
||||||
|
const socialTitle = panel.querySelector('.sm-socials-title') as HTMLElement | null;
|
||||||
|
const socialLinks = Array.from(panel.querySelectorAll('.sm-socials-link')) as HTMLElement[];
|
||||||
|
if (socialTitle) gsap.set(socialTitle, { opacity: 0 });
|
||||||
|
if (socialLinks.length) gsap.set(socialLinks, { y: 25, opacity: 0 });
|
||||||
|
busyRef.current = false;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}, [position]);
|
||||||
|
|
||||||
|
const animateIcon = useCallback((opening: boolean) => {
|
||||||
|
const icon = iconRef.current;
|
||||||
|
if (!icon) return;
|
||||||
|
spinTweenRef.current?.kill();
|
||||||
|
if (opening) {
|
||||||
|
spinTweenRef.current = gsap.to(icon, { rotate: 225, duration: 0.8, ease: 'power4.out', overwrite: 'auto' });
|
||||||
|
} else {
|
||||||
|
spinTweenRef.current = gsap.to(icon, { rotate: 0, duration: 0.35, ease: 'power3.inOut', overwrite: 'auto' });
|
||||||
|
}
|
||||||
|
}, []);
|
||||||
|
|
||||||
|
const animateColor = useCallback(
|
||||||
|
(opening: boolean) => {
|
||||||
|
const btn = toggleBtnRef.current;
|
||||||
|
if (!btn) return;
|
||||||
|
colorTweenRef.current?.kill();
|
||||||
|
if (changeMenuColorOnOpen) {
|
||||||
|
const targetColor = opening ? openMenuButtonColor : menuButtonColor;
|
||||||
|
colorTweenRef.current = gsap.to(btn, {
|
||||||
|
color: targetColor,
|
||||||
|
delay: 0.18,
|
||||||
|
duration: 0.3,
|
||||||
|
ease: 'power2.out'
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
gsap.set(btn, { color: menuButtonColor });
|
||||||
|
}
|
||||||
|
},
|
||||||
|
[openMenuButtonColor, menuButtonColor, changeMenuColorOnOpen]
|
||||||
|
);
|
||||||
|
|
||||||
|
React.useEffect(() => {
|
||||||
|
if (toggleBtnRef.current) {
|
||||||
|
if (changeMenuColorOnOpen) {
|
||||||
|
const targetColor = openRef.current ? openMenuButtonColor : menuButtonColor;
|
||||||
|
gsap.set(toggleBtnRef.current, { color: targetColor });
|
||||||
|
} else {
|
||||||
|
gsap.set(toggleBtnRef.current, { color: menuButtonColor });
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}, [changeMenuColorOnOpen, menuButtonColor, openMenuButtonColor]);
|
||||||
|
|
||||||
|
const animateText = useCallback((opening: boolean) => {
|
||||||
|
const inner = textInnerRef.current;
|
||||||
|
if (!inner) return;
|
||||||
|
textCycleAnimRef.current?.kill();
|
||||||
|
|
||||||
|
const currentLabel = opening ? 'Menu' : 'Close';
|
||||||
|
const targetLabel = opening ? 'Close' : 'Menu';
|
||||||
|
const cycles = 3;
|
||||||
|
const seq: string[] = [currentLabel];
|
||||||
|
let last = currentLabel;
|
||||||
|
for (let i = 0; i < cycles; i++) {
|
||||||
|
last = last === 'Menu' ? 'Close' : 'Menu';
|
||||||
|
seq.push(last);
|
||||||
|
}
|
||||||
|
if (last !== targetLabel) seq.push(targetLabel);
|
||||||
|
seq.push(targetLabel);
|
||||||
|
setTextLines(seq);
|
||||||
|
|
||||||
|
gsap.set(inner, { yPercent: 0 });
|
||||||
|
const lineCount = seq.length;
|
||||||
|
const finalShift = ((lineCount - 1) / lineCount) * 100;
|
||||||
|
textCycleAnimRef.current = gsap.to(inner, {
|
||||||
|
yPercent: -finalShift,
|
||||||
|
duration: 0.5 + lineCount * 0.07,
|
||||||
|
ease: 'power4.out'
|
||||||
|
});
|
||||||
|
}, []);
|
||||||
|
|
||||||
|
const toggleMenu = useCallback(() => {
|
||||||
|
const target = !openRef.current;
|
||||||
|
openRef.current = target;
|
||||||
|
setOpen(target);
|
||||||
|
if (target) {
|
||||||
|
onMenuOpen?.();
|
||||||
|
playOpen();
|
||||||
|
} else {
|
||||||
|
onMenuClose?.();
|
||||||
|
playClose();
|
||||||
|
}
|
||||||
|
animateIcon(target);
|
||||||
|
animateColor(target);
|
||||||
|
animateText(target);
|
||||||
|
}, [playOpen, playClose, animateIcon, animateColor, animateText]);
|
||||||
|
|
||||||
|
const closeMenu = useCallback(() => {
|
||||||
|
if (openRef.current) {
|
||||||
|
openRef.current = false;
|
||||||
|
setOpen(false);
|
||||||
|
onMenuClose?.();
|
||||||
|
playClose();
|
||||||
|
animateIcon(false);
|
||||||
|
animateColor(false);
|
||||||
|
animateText(false);
|
||||||
|
}
|
||||||
|
}, [playClose, animateIcon, animateColor, animateText, onMenuClose]);
|
||||||
|
|
||||||
|
React.useEffect(() => {
|
||||||
|
if (!closeOnClickAway || !open) return;
|
||||||
|
|
||||||
|
const handleClickOutside = (event: MouseEvent) => {
|
||||||
|
if (
|
||||||
|
panelRef.current &&
|
||||||
|
!panelRef.current.contains(event.target as Node) &&
|
||||||
|
toggleBtnRef.current &&
|
||||||
|
!toggleBtnRef.current.contains(event.target as Node)
|
||||||
|
) {
|
||||||
|
closeMenu();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
const handleKey = (event: KeyboardEvent) => {
|
||||||
|
if (event.key === 'Escape') closeMenu();
|
||||||
|
};
|
||||||
|
document.addEventListener('mousedown', handleClickOutside);
|
||||||
|
document.addEventListener('keydown', handleKey);
|
||||||
|
return () => {
|
||||||
|
document.removeEventListener('mousedown', handleClickOutside);
|
||||||
|
document.removeEventListener('keydown', handleKey);
|
||||||
|
};
|
||||||
|
}, [closeOnClickAway, open, closeMenu]);
|
||||||
|
|
||||||
|
return (
|
||||||
|
<div
|
||||||
|
className={(className ? className + ' ' : '') + 'staggered-menu-wrapper' + (isFixed ? ' fixed-wrapper' : '')}
|
||||||
|
style={accentColor ? { ['--sm-accent' as any]: accentColor } : undefined}
|
||||||
|
data-position={position}
|
||||||
|
data-open={open || undefined}
|
||||||
|
>
|
||||||
|
<div ref={preLayersRef} className="sm-prelayers" aria-hidden="true">
|
||||||
|
{(() => {
|
||||||
|
const raw = colors && colors.length ? colors.slice(0, 4) : ['#1e1e22', '#35353c'];
|
||||||
|
let arr = [...raw];
|
||||||
|
if (arr.length >= 3) {
|
||||||
|
const mid = Math.floor(arr.length / 2);
|
||||||
|
arr.splice(mid, 1);
|
||||||
|
}
|
||||||
|
return arr.map((c, i) => <div key={i} className="sm-prelayer" style={{ background: c }} />);
|
||||||
|
})()}
|
||||||
|
</div>
|
||||||
|
<header className="staggered-menu-header" aria-label="Main navigation header">
|
||||||
|
{logoUrl ? (
|
||||||
|
<div className="sm-logo" aria-label="Logo">
|
||||||
|
<img src={logoUrl} alt="Logo" className="sm-logo-img" draggable={false} width={110} height={24} />
|
||||||
|
</div>
|
||||||
|
) : (
|
||||||
|
<span />
|
||||||
|
)}
|
||||||
|
<button
|
||||||
|
ref={toggleBtnRef}
|
||||||
|
className="sm-toggle"
|
||||||
|
aria-label={open ? 'Close menu' : 'Open menu'}
|
||||||
|
aria-expanded={open}
|
||||||
|
aria-controls="staggered-menu-panel"
|
||||||
|
onClick={toggleMenu}
|
||||||
|
type="button"
|
||||||
|
>
|
||||||
|
<span ref={textWrapRef} className="sm-toggle-textWrap" aria-hidden="true">
|
||||||
|
<span ref={textInnerRef} className="sm-toggle-textInner">
|
||||||
|
{textLines.map((l, i) => (
|
||||||
|
<span className="sm-toggle-line" key={i}>
|
||||||
|
{l}
|
||||||
|
</span>
|
||||||
|
))}
|
||||||
|
</span>
|
||||||
|
</span>
|
||||||
|
<span ref={iconRef} className="sm-icon" aria-hidden="true">
|
||||||
|
<span ref={plusHRef} className="sm-icon-line" />
|
||||||
|
<span ref={plusVRef} className="sm-icon-line sm-icon-line-v" />
|
||||||
|
</span>
|
||||||
|
</button>
|
||||||
|
</header>
|
||||||
|
|
||||||
|
<aside id="staggered-menu-panel" ref={panelRef} className="staggered-menu-panel" aria-hidden={!open}>
|
||||||
|
<div className="sm-panel-inner">
|
||||||
|
<ul className="sm-panel-list" role="list" data-numbering={displayItemNumbering || undefined}>
|
||||||
|
{items && items.length ? (
|
||||||
|
items.map((it, idx) => (
|
||||||
|
<li className="sm-panel-itemWrap" key={it.label + idx}>
|
||||||
|
<a
|
||||||
|
className="sm-panel-item"
|
||||||
|
href={it.link}
|
||||||
|
aria-label={it.ariaLabel}
|
||||||
|
aria-current={it.current ? 'page' : undefined}
|
||||||
|
data-index={idx + 1}
|
||||||
|
style={it.color ? ({ ['--item-color' as any]: it.color } as React.CSSProperties) : undefined}
|
||||||
|
onClick={closeMenu}
|
||||||
|
>
|
||||||
|
<span className="sm-panel-itemLabel">{it.label}</span>
|
||||||
|
</a>
|
||||||
|
</li>
|
||||||
|
))
|
||||||
|
) : (
|
||||||
|
<li className="sm-panel-itemWrap" aria-hidden="true">
|
||||||
|
<span className="sm-panel-item">
|
||||||
|
<span className="sm-panel-itemLabel">No items</span>
|
||||||
|
</span>
|
||||||
|
</li>
|
||||||
|
)}
|
||||||
|
</ul>
|
||||||
|
{footer}
|
||||||
|
{displaySocials && socialItems && socialItems.length > 0 && (
|
||||||
|
<div className="sm-socials" aria-label="Social links">
|
||||||
|
<h3 className="sm-socials-title">Socials</h3>
|
||||||
|
<ul className="sm-socials-list" role="list">
|
||||||
|
{socialItems.map((s, i) => (
|
||||||
|
<li key={s.label + i} className="sm-socials-item">
|
||||||
|
<a href={s.link} target="_blank" rel="noopener noreferrer" className="sm-socials-link">
|
||||||
|
{s.label}
|
||||||
|
</a>
|
||||||
|
</li>
|
||||||
|
))}
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
)}
|
||||||
|
</div>
|
||||||
|
</aside>
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
export default StaggeredMenu;
|
||||||
@@ -0,0 +1,157 @@
|
|||||||
|
:root {
|
||||||
|
--sticker-rotate: 30deg;
|
||||||
|
--sticker-p: 10px;
|
||||||
|
--sticker-peelback-hover: 30%;
|
||||||
|
--sticker-peelback-active: 40%;
|
||||||
|
--sticker-peel-easing: power3.out;
|
||||||
|
--sticker-peel-hover-easing: power2.out;
|
||||||
|
--sticker-start: calc(-1 * var(--sticker-p));
|
||||||
|
--sticker-end: calc(100% + var(--sticker-p));
|
||||||
|
--sticker-shadow-opacity: 0.6;
|
||||||
|
--sticker-lighting-constant: 0.1;
|
||||||
|
--peel-direction: 0deg;
|
||||||
|
}
|
||||||
|
|
||||||
|
.sticker-container {
|
||||||
|
position: relative;
|
||||||
|
transform: rotate(var(--peel-direction));
|
||||||
|
transform-origin: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
.sticker-container * {
|
||||||
|
-webkit-user-select: none;
|
||||||
|
user-select: none;
|
||||||
|
-webkit-touch-callout: none;
|
||||||
|
-webkit-tap-highlight-color: transparent;
|
||||||
|
}
|
||||||
|
|
||||||
|
.sticker-main {
|
||||||
|
clip-path: polygon(
|
||||||
|
var(--sticker-start) var(--sticker-start),
|
||||||
|
var(--sticker-end) var(--sticker-start),
|
||||||
|
var(--sticker-end) var(--sticker-end),
|
||||||
|
var(--sticker-start) var(--sticker-end)
|
||||||
|
);
|
||||||
|
transition: clip-path 0.6s ease-out;
|
||||||
|
filter: url(#dropShadow);
|
||||||
|
}
|
||||||
|
|
||||||
|
.sticker-main > * {
|
||||||
|
transform: rotate(calc(-1 * var(--peel-direction)));
|
||||||
|
}
|
||||||
|
|
||||||
|
.sticker-lighting {
|
||||||
|
filter: url(#pointLight);
|
||||||
|
}
|
||||||
|
|
||||||
|
.sticker-container:hover .sticker-main,
|
||||||
|
.sticker-container.touch-active .sticker-main {
|
||||||
|
clip-path: polygon(
|
||||||
|
var(--sticker-start) var(--sticker-peelback-hover),
|
||||||
|
var(--sticker-end) var(--sticker-peelback-hover),
|
||||||
|
var(--sticker-end) var(--sticker-end),
|
||||||
|
var(--sticker-start) var(--sticker-end)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
.sticker-container:active .sticker-main {
|
||||||
|
clip-path: polygon(
|
||||||
|
var(--sticker-start) var(--sticker-peelback-active),
|
||||||
|
var(--sticker-end) var(--sticker-peelback-active),
|
||||||
|
var(--sticker-end) var(--sticker-end),
|
||||||
|
var(--sticker-start) var(--sticker-end)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
.sticker-image {
|
||||||
|
transform: rotate(var(--sticker-rotate));
|
||||||
|
}
|
||||||
|
|
||||||
|
.flap {
|
||||||
|
position: absolute;
|
||||||
|
width: 100%;
|
||||||
|
height: 100%;
|
||||||
|
left: 0;
|
||||||
|
top: calc(-100% - var(--sticker-p) - var(--sticker-p));
|
||||||
|
clip-path: polygon(
|
||||||
|
var(--sticker-start) var(--sticker-start),
|
||||||
|
var(--sticker-end) var(--sticker-start),
|
||||||
|
var(--sticker-end) var(--sticker-start),
|
||||||
|
var(--sticker-start) var(--sticker-start)
|
||||||
|
);
|
||||||
|
transform: scaleY(-1);
|
||||||
|
transition: all 0.6s ease-out;
|
||||||
|
}
|
||||||
|
|
||||||
|
.flap > * {
|
||||||
|
transform: rotate(calc(-1 * var(--peel-direction)));
|
||||||
|
}
|
||||||
|
|
||||||
|
.sticker-container:hover .flap,
|
||||||
|
.sticker-container.touch-active .flap {
|
||||||
|
clip-path: polygon(
|
||||||
|
var(--sticker-start) var(--sticker-start),
|
||||||
|
var(--sticker-end) var(--sticker-start),
|
||||||
|
var(--sticker-end) var(--sticker-peelback-hover),
|
||||||
|
var(--sticker-start) var(--sticker-peelback-hover)
|
||||||
|
);
|
||||||
|
top: calc(-100% + 2 * var(--sticker-peelback-hover) - 1px);
|
||||||
|
}
|
||||||
|
|
||||||
|
.sticker-container:active .flap {
|
||||||
|
clip-path: polygon(
|
||||||
|
var(--sticker-start) var(--sticker-start),
|
||||||
|
var(--sticker-end) var(--sticker-start),
|
||||||
|
var(--sticker-end) var(--sticker-peelback-active),
|
||||||
|
var(--sticker-start) var(--sticker-peelback-active)
|
||||||
|
);
|
||||||
|
top: calc(-100% + 2 * var(--sticker-peelback-active) - 1px);
|
||||||
|
}
|
||||||
|
|
||||||
|
.flap-lighting {
|
||||||
|
filter: url(#pointLightFlipped);
|
||||||
|
}
|
||||||
|
|
||||||
|
.flap-image {
|
||||||
|
transform: rotate(var(--sticker-rotate));
|
||||||
|
filter: url(#expandAndFill);
|
||||||
|
}
|
||||||
|
|
||||||
|
.draggable {
|
||||||
|
position: absolute;
|
||||||
|
cursor: grab;
|
||||||
|
-webkit-transform: translateZ(0);
|
||||||
|
transform: translateZ(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
.draggable:active {
|
||||||
|
cursor: grabbing;
|
||||||
|
}
|
||||||
|
|
||||||
|
@media (hover: none) and (pointer: coarse) {
|
||||||
|
.draggable {
|
||||||
|
cursor: default;
|
||||||
|
}
|
||||||
|
|
||||||
|
.sticker-container {
|
||||||
|
touch-action: none;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.sticker-image,
|
||||||
|
.flap-image {
|
||||||
|
width: var(--sticker-width, 200px);
|
||||||
|
}
|
||||||
|
|
||||||
|
.sticker-main,
|
||||||
|
.flap {
|
||||||
|
will-change: clip-path, transform;
|
||||||
|
}
|
||||||
|
|
||||||
|
.sticker-ripple {
|
||||||
|
position: absolute;
|
||||||
|
border-radius: 50%;
|
||||||
|
background: rgba(255, 255, 255, 0.6);
|
||||||
|
pointer-events: none;
|
||||||
|
z-index: 10;
|
||||||
|
}
|
||||||
@@ -0,0 +1,309 @@
|
|||||||
|
// StickerPeel — from React Bits (https://github.com/DavidHDev/react-bits)
|
||||||
|
// Copyright (c) 2026 David Haz. MIT + Commons Clause. Adapted for yoyos.sh.
|
||||||
|
'use client';
|
||||||
|
|
||||||
|
import { useRef, useEffect, useMemo, type CSSProperties } from 'react';
|
||||||
|
import { gsap } from 'gsap';
|
||||||
|
import { Draggable } from 'gsap/Draggable';
|
||||||
|
import './StickerPeel.css';
|
||||||
|
|
||||||
|
gsap.registerPlugin(Draggable);
|
||||||
|
|
||||||
|
interface StickerPeelProps {
|
||||||
|
imageSrc: string;
|
||||||
|
rotate?: number;
|
||||||
|
peelBackHoverPct?: number;
|
||||||
|
peelBackActivePct?: number;
|
||||||
|
peelEasing?: string;
|
||||||
|
peelHoverEasing?: string;
|
||||||
|
width?: number;
|
||||||
|
shadowIntensity?: number;
|
||||||
|
lightingIntensity?: number;
|
||||||
|
initialPosition?: 'center' | 'random' | { x: number; y: number };
|
||||||
|
peelDirection?: number;
|
||||||
|
className?: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
interface CSSVars extends CSSProperties {
|
||||||
|
'--sticker-rotate'?: string;
|
||||||
|
'--sticker-p'?: string;
|
||||||
|
'--sticker-peelback-hover'?: string;
|
||||||
|
'--sticker-peelback-active'?: string;
|
||||||
|
'--sticker-peel-easing'?: string;
|
||||||
|
'--sticker-peel-hover-easing'?: string;
|
||||||
|
'--sticker-width'?: string;
|
||||||
|
'--sticker-shadow-opacity'?: number;
|
||||||
|
'--sticker-lighting-constant'?: number;
|
||||||
|
'--peel-direction'?: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
const StickerPeel: React.FC<StickerPeelProps> = ({
|
||||||
|
imageSrc,
|
||||||
|
rotate = 30,
|
||||||
|
peelBackHoverPct = 30,
|
||||||
|
peelBackActivePct = 40,
|
||||||
|
peelEasing = 'power3.out',
|
||||||
|
peelHoverEasing = 'power2.out',
|
||||||
|
width = 200,
|
||||||
|
shadowIntensity = 0.6,
|
||||||
|
lightingIntensity = 0.1,
|
||||||
|
initialPosition = 'center',
|
||||||
|
peelDirection = 0,
|
||||||
|
className = ''
|
||||||
|
}) => {
|
||||||
|
const containerRef = useRef<HTMLDivElement>(null);
|
||||||
|
const dragTargetRef = useRef<HTMLDivElement>(null);
|
||||||
|
const pointLightRef = useRef<SVGFEPointLightElement>(null);
|
||||||
|
const pointLightFlippedRef = useRef<SVGFEPointLightElement>(null);
|
||||||
|
const draggableInstanceRef = useRef<Draggable | null>(null);
|
||||||
|
|
||||||
|
const defaultPadding = 10;
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
const target = dragTargetRef.current;
|
||||||
|
if (!target) return;
|
||||||
|
|
||||||
|
let startX = 0,
|
||||||
|
startY = 0;
|
||||||
|
|
||||||
|
if (initialPosition === 'center') {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (typeof initialPosition === 'object' && initialPosition.x !== undefined && initialPosition.y !== undefined) {
|
||||||
|
startX = initialPosition.x;
|
||||||
|
startY = initialPosition.y;
|
||||||
|
}
|
||||||
|
|
||||||
|
gsap.set(target, { x: startX, y: startY });
|
||||||
|
}, [initialPosition]);
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
const target = dragTargetRef.current;
|
||||||
|
if (!target) return;
|
||||||
|
|
||||||
|
const boundsEl = target.parentNode as HTMLElement;
|
||||||
|
|
||||||
|
const draggable = Draggable.create(target, {
|
||||||
|
type: 'x,y',
|
||||||
|
bounds: boundsEl,
|
||||||
|
inertia: true,
|
||||||
|
onDrag(this: Draggable) {
|
||||||
|
const rot = gsap.utils.clamp(-24, 24, this.deltaX * 0.4);
|
||||||
|
gsap.to(target, { rotation: rot, duration: 0.15, ease: 'power1.out' });
|
||||||
|
},
|
||||||
|
onDragEnd() {
|
||||||
|
const rotationEase = 'power2.out';
|
||||||
|
const duration = 0.8;
|
||||||
|
gsap.to(target, { rotation: 0, duration, ease: rotationEase });
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
draggableInstanceRef.current = draggable[0];
|
||||||
|
|
||||||
|
const handleResize = () => {
|
||||||
|
if (draggableInstanceRef.current) {
|
||||||
|
draggableInstanceRef.current.update();
|
||||||
|
|
||||||
|
const currentX = gsap.getProperty(target, 'x') as number;
|
||||||
|
const currentY = gsap.getProperty(target, 'y') as number;
|
||||||
|
|
||||||
|
const boundsRect = boundsEl.getBoundingClientRect();
|
||||||
|
const targetRect = target.getBoundingClientRect();
|
||||||
|
|
||||||
|
const maxX = boundsRect.width - targetRect.width;
|
||||||
|
const maxY = boundsRect.height - targetRect.height;
|
||||||
|
|
||||||
|
const newX = Math.max(0, Math.min(currentX, maxX));
|
||||||
|
const newY = Math.max(0, Math.min(currentY, maxY));
|
||||||
|
|
||||||
|
if (newX !== currentX || newY !== currentY) {
|
||||||
|
gsap.to(target, {
|
||||||
|
x: newX,
|
||||||
|
y: newY,
|
||||||
|
duration: 0.3,
|
||||||
|
ease: 'power2.out'
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
window.addEventListener('resize', handleResize);
|
||||||
|
window.addEventListener('orientationchange', handleResize);
|
||||||
|
|
||||||
|
return () => {
|
||||||
|
window.removeEventListener('resize', handleResize);
|
||||||
|
window.removeEventListener('orientationchange', handleResize);
|
||||||
|
if (draggableInstanceRef.current) {
|
||||||
|
draggableInstanceRef.current.kill();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}, []);
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
const updateLight = (e: Event) => {
|
||||||
|
const mouseEvent = e as MouseEvent;
|
||||||
|
const rect = containerRef.current?.getBoundingClientRect();
|
||||||
|
if (!rect) return;
|
||||||
|
|
||||||
|
const x = mouseEvent.clientX - rect.left;
|
||||||
|
const y = mouseEvent.clientY - rect.top;
|
||||||
|
|
||||||
|
if (pointLightRef.current) {
|
||||||
|
gsap.set(pointLightRef.current, { attr: { x, y } });
|
||||||
|
}
|
||||||
|
|
||||||
|
const normalizedAngle = Math.abs(peelDirection % 360);
|
||||||
|
if (pointLightFlippedRef.current) {
|
||||||
|
if (normalizedAngle !== 180) {
|
||||||
|
gsap.set(pointLightFlippedRef.current, {
|
||||||
|
attr: { x, y: rect.height - y }
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
gsap.set(pointLightFlippedRef.current, {
|
||||||
|
attr: { x: -1000, y: -1000 }
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
const container = containerRef.current;
|
||||||
|
const eventType = 'mousemove';
|
||||||
|
|
||||||
|
if (container) {
|
||||||
|
container.addEventListener(eventType, updateLight);
|
||||||
|
return () => container.removeEventListener(eventType, updateLight);
|
||||||
|
}
|
||||||
|
}, [peelDirection]);
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
const container = containerRef.current;
|
||||||
|
if (!container) return;
|
||||||
|
|
||||||
|
const handleTouchStart = () => {
|
||||||
|
container.classList.add('touch-active');
|
||||||
|
};
|
||||||
|
|
||||||
|
const handleTouchEnd = () => {
|
||||||
|
container.classList.remove('touch-active');
|
||||||
|
};
|
||||||
|
|
||||||
|
container.addEventListener('touchstart', handleTouchStart);
|
||||||
|
container.addEventListener('touchend', handleTouchEnd);
|
||||||
|
container.addEventListener('touchcancel', handleTouchEnd);
|
||||||
|
|
||||||
|
return () => {
|
||||||
|
container.removeEventListener('touchstart', handleTouchStart);
|
||||||
|
container.removeEventListener('touchend', handleTouchEnd);
|
||||||
|
container.removeEventListener('touchcancel', handleTouchEnd);
|
||||||
|
};
|
||||||
|
}, []);
|
||||||
|
|
||||||
|
const cssVars: CSSVars = useMemo(
|
||||||
|
() => ({
|
||||||
|
'--sticker-rotate': `${rotate}deg`,
|
||||||
|
'--sticker-p': `${defaultPadding}px`,
|
||||||
|
'--sticker-peelback-hover': `${peelBackHoverPct}%`,
|
||||||
|
'--sticker-peelback-active': `${peelBackActivePct}%`,
|
||||||
|
'--sticker-peel-easing': peelEasing,
|
||||||
|
'--sticker-peel-hover-easing': peelHoverEasing,
|
||||||
|
'--sticker-width': `${width}px`,
|
||||||
|
'--sticker-shadow-opacity': shadowIntensity,
|
||||||
|
'--sticker-lighting-constant': lightingIntensity,
|
||||||
|
'--peel-direction': `${peelDirection}deg`
|
||||||
|
}),
|
||||||
|
[
|
||||||
|
rotate,
|
||||||
|
peelBackHoverPct,
|
||||||
|
peelBackActivePct,
|
||||||
|
peelEasing,
|
||||||
|
peelHoverEasing,
|
||||||
|
width,
|
||||||
|
shadowIntensity,
|
||||||
|
lightingIntensity,
|
||||||
|
peelDirection
|
||||||
|
]
|
||||||
|
);
|
||||||
|
|
||||||
|
return (
|
||||||
|
<div className={`draggable ${className}`} ref={dragTargetRef} style={cssVars}>
|
||||||
|
<svg width="0" height="0">
|
||||||
|
<defs>
|
||||||
|
<filter id="pointLight">
|
||||||
|
<feGaussianBlur stdDeviation="1" result="blur" />
|
||||||
|
<feSpecularLighting
|
||||||
|
result="spec"
|
||||||
|
in="blur"
|
||||||
|
specularExponent="100"
|
||||||
|
specularConstant={lightingIntensity}
|
||||||
|
lightingColor="white"
|
||||||
|
>
|
||||||
|
<fePointLight ref={pointLightRef} x="100" y="100" z="300" />
|
||||||
|
</feSpecularLighting>
|
||||||
|
<feComposite in="spec" in2="SourceGraphic" result="lit" />
|
||||||
|
<feComposite in="lit" in2="SourceAlpha" operator="in" />
|
||||||
|
</filter>
|
||||||
|
|
||||||
|
<filter id="pointLightFlipped">
|
||||||
|
<feGaussianBlur stdDeviation="10" result="blur" />
|
||||||
|
<feSpecularLighting
|
||||||
|
result="spec"
|
||||||
|
in="blur"
|
||||||
|
specularExponent="100"
|
||||||
|
specularConstant={lightingIntensity * 7}
|
||||||
|
lightingColor="white"
|
||||||
|
>
|
||||||
|
<fePointLight ref={pointLightFlippedRef} x="100" y="100" z="300" />
|
||||||
|
</feSpecularLighting>
|
||||||
|
<feComposite in="spec" in2="SourceGraphic" result="lit" />
|
||||||
|
<feComposite in="lit" in2="SourceAlpha" operator="in" />
|
||||||
|
</filter>
|
||||||
|
|
||||||
|
<filter id="dropShadow">
|
||||||
|
<feDropShadow
|
||||||
|
dx="2"
|
||||||
|
dy="4"
|
||||||
|
stdDeviation={3 * shadowIntensity}
|
||||||
|
floodColor="black"
|
||||||
|
floodOpacity={shadowIntensity}
|
||||||
|
/>
|
||||||
|
</filter>
|
||||||
|
|
||||||
|
<filter id="expandAndFill">
|
||||||
|
<feOffset dx="0" dy="0" in="SourceAlpha" result="shape" />
|
||||||
|
<feFlood floodColor="rgb(179,179,179)" result="flood" />
|
||||||
|
<feComposite operator="in" in="flood" in2="shape" />
|
||||||
|
</filter>
|
||||||
|
</defs>
|
||||||
|
</svg>
|
||||||
|
|
||||||
|
<div className="sticker-container" ref={containerRef}>
|
||||||
|
<div className="sticker-main">
|
||||||
|
<div className="sticker-lighting">
|
||||||
|
<img
|
||||||
|
src={imageSrc}
|
||||||
|
alt=""
|
||||||
|
className="sticker-image"
|
||||||
|
draggable="false"
|
||||||
|
onContextMenu={e => e.preventDefault()}
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div className="flap">
|
||||||
|
<div className="flap-lighting">
|
||||||
|
<img
|
||||||
|
src={imageSrc}
|
||||||
|
alt=""
|
||||||
|
className="flap-image"
|
||||||
|
draggable="false"
|
||||||
|
onContextMenu={e => e.preventDefault()}
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
export default StickerPeel;
|
||||||
@@ -0,0 +1,170 @@
|
|||||||
|
---
|
||||||
|
/**
|
||||||
|
* A real photo treated like a magazine clipping: optional tape, tilt, torn
|
||||||
|
* edge and print treatments (duotone / halftone / b&w).
|
||||||
|
*/
|
||||||
|
import { Image } from 'astro:assets';
|
||||||
|
import type { ImageMetadata } from 'astro';
|
||||||
|
|
||||||
|
interface Props {
|
||||||
|
src: ImageMetadata;
|
||||||
|
alt?: string;
|
||||||
|
rotate?: number;
|
||||||
|
tape?: 'top' | 'corners' | 'none';
|
||||||
|
treatment?: 'none' | 'duotone' | 'halftone' | 'bw' | 'riso';
|
||||||
|
/** duotone/riso ink color */
|
||||||
|
ink?: string;
|
||||||
|
torn?: boolean;
|
||||||
|
border?: boolean;
|
||||||
|
ratio?: string;
|
||||||
|
position?: string;
|
||||||
|
widths?: number[];
|
||||||
|
sizes?: string;
|
||||||
|
loading?: 'lazy' | 'eager';
|
||||||
|
class?: string;
|
||||||
|
caption?: string;
|
||||||
|
[attr: string]: unknown;
|
||||||
|
}
|
||||||
|
const {
|
||||||
|
src,
|
||||||
|
alt = '',
|
||||||
|
rotate = 0,
|
||||||
|
tape = 'none',
|
||||||
|
treatment = 'none',
|
||||||
|
ink = 'var(--cta-red)',
|
||||||
|
torn = false,
|
||||||
|
border = true,
|
||||||
|
ratio,
|
||||||
|
position = 'center',
|
||||||
|
widths = [360, 640, 960],
|
||||||
|
sizes = '(min-width: 60rem) 40vw, 90vw',
|
||||||
|
loading = 'lazy',
|
||||||
|
class: cls,
|
||||||
|
caption,
|
||||||
|
...rest
|
||||||
|
} = Astro.props;
|
||||||
|
---
|
||||||
|
|
||||||
|
<figure
|
||||||
|
{...rest}
|
||||||
|
class:list={['clip', `t-${treatment}`, `tape-${tape}`, { torn, border }, cls]}
|
||||||
|
style={`--rot:${rotate}deg;--ink:${ink};${ratio ? `--ratio:${ratio};` : ''}--pos:${position}`}
|
||||||
|
>
|
||||||
|
<div class="frame">
|
||||||
|
<Image src={src} alt={alt} widths={widths} sizes={sizes} loading={loading} />
|
||||||
|
</div>
|
||||||
|
{caption && <figcaption>{caption}</figcaption>}
|
||||||
|
</figure>
|
||||||
|
|
||||||
|
<style>
|
||||||
|
.clip {
|
||||||
|
position: relative;
|
||||||
|
rotate: var(--rot);
|
||||||
|
margin: 0;
|
||||||
|
}
|
||||||
|
.border .frame {
|
||||||
|
padding: 6px;
|
||||||
|
background: #fffdf7;
|
||||||
|
box-shadow:
|
||||||
|
0 1px 0 rgb(0 0 0 / 0.08),
|
||||||
|
0 10px 24px -14px rgb(0 0 0 / 0.55);
|
||||||
|
}
|
||||||
|
.frame {
|
||||||
|
position: relative;
|
||||||
|
overflow: hidden;
|
||||||
|
isolation: isolate;
|
||||||
|
}
|
||||||
|
.frame :global(img) {
|
||||||
|
width: 100%;
|
||||||
|
height: 100%;
|
||||||
|
aspect-ratio: var(--ratio, auto);
|
||||||
|
object-fit: cover;
|
||||||
|
object-position: var(--pos);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* print treatments */
|
||||||
|
.t-bw .frame :global(img) {
|
||||||
|
filter: grayscale(1) contrast(1.25);
|
||||||
|
}
|
||||||
|
.t-duotone .frame :global(img),
|
||||||
|
.t-riso .frame :global(img) {
|
||||||
|
filter: grayscale(1) contrast(1.35) brightness(1.05);
|
||||||
|
}
|
||||||
|
.t-duotone .frame::after,
|
||||||
|
.t-riso .frame::after {
|
||||||
|
content: '';
|
||||||
|
position: absolute;
|
||||||
|
inset: 6px;
|
||||||
|
background: var(--ink);
|
||||||
|
mix-blend-mode: screen;
|
||||||
|
pointer-events: none;
|
||||||
|
}
|
||||||
|
.t-riso .frame::before {
|
||||||
|
content: '';
|
||||||
|
position: absolute;
|
||||||
|
inset: 6px;
|
||||||
|
z-index: 1;
|
||||||
|
background: radial-gradient(circle, rgb(0 0 0 / 0.35) 0.9px, transparent 1.3px) 0 0 / 5px 5px;
|
||||||
|
mix-blend-mode: multiply;
|
||||||
|
pointer-events: none;
|
||||||
|
}
|
||||||
|
.t-halftone .frame::after {
|
||||||
|
content: '';
|
||||||
|
position: absolute;
|
||||||
|
inset: 6px;
|
||||||
|
background: radial-gradient(circle, rgb(0 0 0 / 0.5) 1px, transparent 1.5px) 0 0 / 5px 5px;
|
||||||
|
mix-blend-mode: multiply;
|
||||||
|
pointer-events: none;
|
||||||
|
}
|
||||||
|
.clip:not(.border) .frame::after,
|
||||||
|
.clip:not(.border) .frame::before {
|
||||||
|
inset: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* torn bottom edge */
|
||||||
|
.torn .frame {
|
||||||
|
-webkit-mask: linear-gradient(#000 0 0) top / 100% calc(100% - 10px) no-repeat,
|
||||||
|
conic-gradient(from -45deg at bottom, #0000, #000 1deg 89deg, #0000 90deg) bottom / 14px 10px repeat-x;
|
||||||
|
mask: linear-gradient(#000 0 0) top / 100% calc(100% - 10px) no-repeat,
|
||||||
|
conic-gradient(from -45deg at bottom, #0000, #000 1deg 89deg, #0000 90deg) bottom / 14px 10px repeat-x;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* masking tape */
|
||||||
|
.tape-top::before,
|
||||||
|
.tape-corners::before,
|
||||||
|
.tape-corners::after {
|
||||||
|
content: '';
|
||||||
|
position: absolute;
|
||||||
|
z-index: 2;
|
||||||
|
width: 34%;
|
||||||
|
max-width: 7rem;
|
||||||
|
height: 1.5rem;
|
||||||
|
background: color-mix(in oklab, #f3e7b8 78%, transparent);
|
||||||
|
box-shadow: 0 1px 2px rgb(0 0 0 / 0.15);
|
||||||
|
-webkit-mask: conic-gradient(from 135deg at left, #0000, #000 1deg 89deg, #0000 90deg) left / 4px 6px repeat-y,
|
||||||
|
linear-gradient(#000 0 0) center / calc(100% - 8px) 100% no-repeat,
|
||||||
|
conic-gradient(from -45deg at right, #0000, #000 1deg 89deg, #0000 90deg) right / 4px 6px repeat-y;
|
||||||
|
}
|
||||||
|
.tape-top::before {
|
||||||
|
top: -0.7rem;
|
||||||
|
left: 50%;
|
||||||
|
translate: -50% 0;
|
||||||
|
rotate: -3deg;
|
||||||
|
}
|
||||||
|
.tape-corners::before {
|
||||||
|
top: -0.5rem;
|
||||||
|
left: -1rem;
|
||||||
|
rotate: -35deg;
|
||||||
|
}
|
||||||
|
.tape-corners::after {
|
||||||
|
bottom: -0.5rem;
|
||||||
|
right: -1rem;
|
||||||
|
rotate: -35deg;
|
||||||
|
}
|
||||||
|
figcaption {
|
||||||
|
margin-top: 0.35rem;
|
||||||
|
font-family: var(--ff-mono);
|
||||||
|
font-size: 0.7rem;
|
||||||
|
color: var(--fg-muted);
|
||||||
|
}
|
||||||
|
</style>
|
||||||
@@ -0,0 +1,242 @@
|
|||||||
|
[
|
||||||
|
{
|
||||||
|
"file": "botanical",
|
||||||
|
"title": "Japanese cherry blossom branch C.J",
|
||||||
|
"creator": "rijksmuseum",
|
||||||
|
"license": "CC0 1.0 (public domain dedication)",
|
||||||
|
"source": "rawpixel",
|
||||||
|
"url": "https://www.rawpixel.com/image/503781/free-illustration-image-sakura-cherry-blossoms-background"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"file": "cassette",
|
||||||
|
"title": "Free vintage cassette tape image",
|
||||||
|
"creator": "Unknown",
|
||||||
|
"license": "CC0 1.0 (public domain dedication)",
|
||||||
|
"source": "rawpixel",
|
||||||
|
"url": "https://www.rawpixel.com/image/5907587/photo-image-tape-public-domain-black"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"file": "chicago-aerial",
|
||||||
|
"title": "Chicago Skyline lakefront. Original image",
|
||||||
|
"creator": "Carol M Highsmith",
|
||||||
|
"license": "CC0 1.0 (public domain dedication)",
|
||||||
|
"source": "rawpixel",
|
||||||
|
"url": "https://www.rawpixel.com/image/433891/free-photo-image-chicago-city-illinois-lakes"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"file": "chicago-skyline-red",
|
||||||
|
"title": "Chicago's skyline appears silhouette sunset",
|
||||||
|
"creator": "Carol M Highsmith",
|
||||||
|
"license": "CC0 1.0 (public domain dedication)",
|
||||||
|
"source": "rawpixel",
|
||||||
|
"url": "https://www.rawpixel.com/image/3094116/free-photo-image-night-sunset-background-chicago"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"file": "cloud",
|
||||||
|
"title": "Cumulus Clouds",
|
||||||
|
"creator": "Free Nature Stock",
|
||||||
|
"license": "CC0 1.0 (public domain dedication)",
|
||||||
|
"source": "stocksnap",
|
||||||
|
"url": "https://stocksnap.io/photo/cumulus-clouds-RNUVHVEM6Q"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"file": "computers-pile",
|
||||||
|
"title": "Free pile old computers",
|
||||||
|
"creator": "Unknown",
|
||||||
|
"license": "CC0 1.0 (public domain dedication)",
|
||||||
|
"source": "rawpixel",
|
||||||
|
"url": "https://www.rawpixel.com/image/5906713/photo-image-aesthetic-public-domain-computer"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"file": "computers-room",
|
||||||
|
"title": "Free bunch old computers image",
|
||||||
|
"creator": "Unknown",
|
||||||
|
"license": "CC0 1.0 (public domain dedication)",
|
||||||
|
"source": "rawpixel",
|
||||||
|
"url": "https://www.rawpixel.com/image/5905997/photo-image-public-domain-shadow-technology"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"file": "cta-sign",
|
||||||
|
"title": "Scratched sign for the Chicago El Red Line to 95/Dan Ryan at North/Clybourne on a white pillar with a train moving in the background.",
|
||||||
|
"creator": "Aaron Jorbin",
|
||||||
|
"license": "CC0 1.0 (public domain dedication)",
|
||||||
|
"source": "wordpress",
|
||||||
|
"url": "https://wordpress.org/photos/photo/97765b5444/"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"file": "daisies",
|
||||||
|
"title": "Daisies Flower",
|
||||||
|
"creator": "Bob Richards",
|
||||||
|
"license": "CC0 1.0 (public domain dedication)",
|
||||||
|
"source": "stocksnap",
|
||||||
|
"url": "https://stocksnap.io/photo/daisies-flower-M5XV7XMR6W"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"file": "floppies-sticker",
|
||||||
|
"title": "Old computer disk",
|
||||||
|
"creator": "Unknown",
|
||||||
|
"license": "CC0 1.0 (public domain dedication)",
|
||||||
|
"source": "rawpixel",
|
||||||
|
"url": "https://www.rawpixel.com/image/6040633/old-computer-disk-free-public-domain-cc0-photo"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"file": "forest",
|
||||||
|
"title": "Forest Mountain",
|
||||||
|
"creator": "Matt Bango",
|
||||||
|
"license": "CC0 1.0 (public domain dedication)",
|
||||||
|
"source": "stocksnap",
|
||||||
|
"url": "https://stocksnap.io/photo/forest-mountain-NXXYL23EIL"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"file": "gba-sticker",
|
||||||
|
"title": "Nintendo-Game-Boy-Advance-Purple-FL",
|
||||||
|
"creator": "Evan-Amos",
|
||||||
|
"license": "CC0 1.0 (public domain dedication)",
|
||||||
|
"source": "wikimedia",
|
||||||
|
"url": "https://commons.wikimedia.org/w/index.php?curid=122403889"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"file": "grass-top",
|
||||||
|
"title": "Grass Daisies",
|
||||||
|
"creator": "Eric Lagergren",
|
||||||
|
"license": "CC0 1.0 (public domain dedication)",
|
||||||
|
"source": "stocksnap",
|
||||||
|
"url": "https://stocksnap.io/photo/grass-daisies-6ADE4054B3"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"file": "guitar-hollow",
|
||||||
|
"title": "Electric Guitar",
|
||||||
|
"creator": "Thomas Kelley",
|
||||||
|
"license": "CC0 1.0 (public domain dedication)",
|
||||||
|
"source": "stocksnap",
|
||||||
|
"url": "https://stocksnap.io/photo/electric-guitar-SQ2DL1GFQF"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"file": "guitar-strat",
|
||||||
|
"title": "Electric Guitar",
|
||||||
|
"creator": "Markus Spiske",
|
||||||
|
"license": "CC0 1.0 (public domain dedication)",
|
||||||
|
"source": "stocksnap",
|
||||||
|
"url": "https://stocksnap.io/photo/electric-guitar-UIT62UUU5X"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"file": "hibiscus",
|
||||||
|
"title": "Hibiscus flower",
|
||||||
|
"creator": "U.S. National Archives",
|
||||||
|
"license": "CC0 1.0 (public domain dedication)",
|
||||||
|
"source": "rawpixel",
|
||||||
|
"url": "https://www.rawpixel.com/image/8799471/photo-image-flower-plant-vintage"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"file": "lily",
|
||||||
|
"title": "Isolated Flower Black Background",
|
||||||
|
"creator": "Unknown",
|
||||||
|
"license": "CC0 1.0 (public domain dedication)",
|
||||||
|
"source": "rawpixel",
|
||||||
|
"url": "https://www.rawpixel.com/image/5967321/isolated-flower-black-background"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"file": "marina-city",
|
||||||
|
"title": "Chicago-river-st-patricks-day-pd-pictures",
|
||||||
|
"creator": "Dave Zab",
|
||||||
|
"license": "CC0 1.0 (public domain dedication)",
|
||||||
|
"source": "wikimedia",
|
||||||
|
"url": "https://commons.wikimedia.org/w/index.php?curid=79847237"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"file": "marina-city-river",
|
||||||
|
"title": "Chicago River downtown Chicago",
|
||||||
|
"creator": "Carol M Highsmith",
|
||||||
|
"license": "CC0 1.0 (public domain dedication)",
|
||||||
|
"source": "rawpixel",
|
||||||
|
"url": "https://www.rawpixel.com/image/433928/free-photo-image-chicago-architecture-building"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"file": "motorcycle",
|
||||||
|
"title": "Motorcycle Honda",
|
||||||
|
"creator": "Andrew James Kovalsky",
|
||||||
|
"license": "CC0 1.0 (public domain dedication)",
|
||||||
|
"source": "stocksnap",
|
||||||
|
"url": "https://stocksnap.io/photo/motorcycle-honda-DWKVL4HHDU"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"file": "paper-crumpled",
|
||||||
|
"title": "Free crumpled paper texture background",
|
||||||
|
"creator": "Unknown",
|
||||||
|
"license": "CC0 1.0 (public domain dedication)",
|
||||||
|
"source": "rawpixel",
|
||||||
|
"url": "https://www.rawpixel.com/image/5904241/photo-image-background-texture-public-domain"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"file": "paper-kraft",
|
||||||
|
"title": "Free old paper texture image",
|
||||||
|
"creator": "Unknown",
|
||||||
|
"license": "CC0 1.0 (public domain dedication)",
|
||||||
|
"source": "rawpixel",
|
||||||
|
"url": "https://www.rawpixel.com/image/5913072/image-paper-texture-old"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"file": "pedalboard",
|
||||||
|
"title": "Telecaster Thinline type guitar with pedalboard (SecretPreamp,MXR10BandEQ,Supa-Trem,POG2,SP Comp,Tuner,BigSky,SeaMachine,GigaDelay,TimmyOverdrive,Broadcast,VolumPedal) - The Smith Center, Las Vegas (2017-04-29 10.28.27 piqsels.com en)",
|
||||||
|
"creator": "Unknown authorUnknown author",
|
||||||
|
"license": "CC0 1.0 (public domain dedication)",
|
||||||
|
"source": "wikimedia",
|
||||||
|
"url": "https://commons.wikimedia.org/w/index.php?curid=116006535"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"file": "postcard-back",
|
||||||
|
"title": "Postcard - South East Facade, Exhibition Building, JW Lindt, Melbourne, circa 1905",
|
||||||
|
"creator": "Unknown",
|
||||||
|
"license": "Public Domain Mark",
|
||||||
|
"source": "museumsvictoria",
|
||||||
|
"url": "https://collections.museumsvictoria.com.au/items/255268"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"file": "railroad-postcard",
|
||||||
|
"title": "Chicago- Railroad center world",
|
||||||
|
"creator": "Unknown",
|
||||||
|
"license": "CC0 1.0 (public domain dedication)",
|
||||||
|
"source": "rawpixel",
|
||||||
|
"url": "https://www.rawpixel.com/image/8906028/image-texture-arts-vintage"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"file": "server-rack",
|
||||||
|
"title": "File:Rear of rack at NERSC data center - closeup.jpg",
|
||||||
|
"creator": "Derrick Coetzee from Berkeley, CA, USA",
|
||||||
|
"license": "CC0 1.0 (public domain dedication)",
|
||||||
|
"source": "wikimedia",
|
||||||
|
"url": "https://commons.wikimedia.org/w/index.php?curid=17460421"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"file": "subway-map",
|
||||||
|
"title": "Plate 80 Plan Chicago, 1909:",
|
||||||
|
"creator": "artinstitutechicago",
|
||||||
|
"license": "CC0 1.0 (public domain dedication)",
|
||||||
|
"source": "rawpixel",
|
||||||
|
"url": "https://www.rawpixel.com/image/8937739/image-roads-map-plate"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"file": "synth",
|
||||||
|
"title": "Synthesizer Keyboard",
|
||||||
|
"creator": "Skitter Photo",
|
||||||
|
"license": "CC0 1.0 (public domain dedication)",
|
||||||
|
"source": "stocksnap",
|
||||||
|
"url": "https://stocksnap.io/photo/synthesizer-keyboard-QVZN44GAXB"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"file": "tv",
|
||||||
|
"title": "Vintage television",
|
||||||
|
"creator": "Unknown",
|
||||||
|
"license": "CC0 1.0 (public domain dedication)",
|
||||||
|
"source": "rawpixel",
|
||||||
|
"url": "https://www.rawpixel.com/image/5904973/vintage-television-free-public-domain-cc0-photo"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"file": "union-station",
|
||||||
|
"title": "Chicago, Illinois. waiting room Union",
|
||||||
|
"creator": "Unknown",
|
||||||
|
"license": "CC0 1.0 (public domain dedication)",
|
||||||
|
"source": "rawpixel",
|
||||||
|
"url": "https://www.rawpixel.com/image/8718166/photo-image-vintage-public-domain-person"
|
||||||
|
}
|
||||||
|
]
|
||||||
@@ -46,7 +46,8 @@ const person = {
|
|||||||
<html lang="en" data-theme={theme}>
|
<html lang="en" data-theme={theme}>
|
||||||
<head>
|
<head>
|
||||||
<meta charset="utf-8" />
|
<meta charset="utf-8" />
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
<meta name="viewport" content="width=device-width, initial-scale=1, viewport-fit=cover" />
|
||||||
|
<meta name="theme-color" content="#f3ecd9" />
|
||||||
<title>{fullTitle}</title>
|
<title>{fullTitle}</title>
|
||||||
<meta name="description" content={description} />
|
<meta name="description" content={description} />
|
||||||
<link rel="canonical" href={canonical} />
|
<link rel="canonical" href={canonical} />
|
||||||
@@ -73,6 +74,9 @@ const person = {
|
|||||||
<slot />
|
<slot />
|
||||||
</main>
|
</main>
|
||||||
<Footer />
|
<Footer />
|
||||||
|
<script>
|
||||||
|
import '../scripts/motion';
|
||||||
|
</script>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|
||||||
|
|||||||
@@ -1,12 +1,12 @@
|
|||||||
// Project categories. Each one is a "subway line" with a letter and color.
|
// Project categories. Each one rides a Chicago 'L' line: letter badge + CTA color.
|
||||||
export const DISCIPLINES = ['software', 'web', 'game', 'hardware', '3d', 'music'] as const;
|
export const DISCIPLINES = ['software', 'web', 'game', 'hardware', '3d', 'music'] as const;
|
||||||
export type Discipline = (typeof DISCIPLINES)[number];
|
export type Discipline = (typeof DISCIPLINES)[number];
|
||||||
|
|
||||||
export const LINES: Record<Discipline, { label: string; letter: string; color: string; fg: string }> = {
|
export const LINES: Record<Discipline, { label: string; letter: string; color: string; fg: string; line: string }> = {
|
||||||
software: { label: 'Software & Tools', letter: 'S', color: 'var(--emerald)', fg: '#fff' },
|
software: { label: 'Software & Tools', letter: 'S', color: 'var(--cta-green)', fg: '#fff', line: 'Green Line' },
|
||||||
web: { label: 'Web', letter: 'W', color: 'var(--cobalt)', fg: '#fff' },
|
web: { label: 'Web', letter: 'W', color: 'var(--cta-blue)', fg: '#fff', line: 'Blue Line' },
|
||||||
game: { label: 'Games', letter: 'G', color: 'var(--red)', fg: '#fff' },
|
game: { label: 'Games', letter: 'G', color: 'var(--cta-red)', fg: '#fff', line: 'Red Line' },
|
||||||
hardware: { label: 'Hardware', letter: 'H', color: 'var(--orange)', fg: '#141412' },
|
hardware: { label: 'Hardware', letter: 'H', color: 'var(--cta-brown)', fg: '#fff', line: 'Brown Line' },
|
||||||
'3d': { label: '3D', letter: '3', color: 'var(--violet)', fg: '#fff' },
|
'3d': { label: '3D', letter: '3', color: 'var(--cta-purple)', fg: '#fff', line: 'Purple Line' },
|
||||||
music: { label: 'Music', letter: 'M', color: 'var(--yellow)', fg: '#141412' },
|
music: { label: 'Music', letter: 'M', color: 'var(--cta-pink)', fg: '#141412', line: 'Pink Line' },
|
||||||
};
|
};
|
||||||
@@ -23,10 +23,10 @@ export const SITE = {
|
|||||||
} as const;
|
} as const;
|
||||||
|
|
||||||
export const NAV = [
|
export const NAV = [
|
||||||
{ href: '/work', label: 'Work', color: 'var(--line-work)', fg: '#fff' },
|
{ href: '/work', label: 'Work', color: 'var(--line-work)', fg: '#fff', hex: '#c60c30' },
|
||||||
{ href: '/blog', label: 'Blog', color: 'var(--line-blog)', fg: '#fff' },
|
{ href: '/blog', label: 'Blog', color: 'var(--line-blog)', fg: '#fff', hex: '#00a1de' },
|
||||||
{ href: '/music', label: 'Music', color: 'var(--line-music)', fg: '#141412' },
|
{ href: '/music', label: 'Music', color: 'var(--line-music)', fg: '#141412', hex: '#e27ea6' },
|
||||||
{ href: '/models', label: '3D', color: 'var(--line-3d)', fg: '#fff' },
|
{ href: '/models', label: '3D', color: 'var(--line-3d)', fg: '#fff', hex: '#522398' },
|
||||||
{ href: '/about', label: 'About', color: 'var(--line-about)', fg: '#fff' },
|
{ href: '/about', label: 'About', color: 'var(--line-about)', fg: '#fff', hex: '#009b3a' },
|
||||||
{ href: '/contact', label: 'Contact', color: 'var(--line-contact)', fg: '#141412' },
|
{ href: '/contact', label: 'Contact', color: 'var(--line-contact)', fg: '#fff', hex: '#f9461c' },
|
||||||
] as const;
|
] as const;
|
||||||
@@ -1,6 +1,17 @@
|
|||||||
---
|
---
|
||||||
import Base from '../layouts/Base.astro';
|
import Base from '../layouts/Base.astro';
|
||||||
import { SITE } from '../lib/site';
|
import { SITE } from '../lib/site';
|
||||||
|
import { Image } from 'astro:assets';
|
||||||
|
import Clipping from '../components/deco/Clipping.astro';
|
||||||
|
import daisies from '../assets/photos/daisies.jpg';
|
||||||
|
import grassTop from '../assets/photos/grass-top.jpg';
|
||||||
|
import botanical from '../assets/photos/botanical.jpg';
|
||||||
|
import lily from '../assets/photos/lily.jpg';
|
||||||
|
import marinaRiver from '../assets/photos/marina-city-river.jpg';
|
||||||
|
import serverRack from '../assets/photos/server-rack.jpg';
|
||||||
|
import computers from '../assets/photos/computers-room.jpg';
|
||||||
|
|
||||||
|
const packetPhotos = [grassTop, computers, serverRack, botanical, lily];
|
||||||
|
|
||||||
const skills = [
|
const skills = [
|
||||||
{ k: 'Languages', v: ['Python', 'PowerShell', 'TypeScript / JavaScript', 'SQL', 'Bash'] },
|
{ k: 'Languages', v: ['Python', 'PowerShell', 'TypeScript / JavaScript', 'SQL', 'Bash'] },
|
||||||
@@ -51,32 +62,11 @@ const timeline = [
|
|||||||
},
|
},
|
||||||
];
|
];
|
||||||
|
|
||||||
// Deterministic grass blades for the hero.
|
|
||||||
const blades = Array.from({ length: 140 }, (_, i) => {
|
|
||||||
const r = (n: number) => ((Math.sin(i * 12.9898 + n * 78.233) * 43758.5453) % 1 + 1) % 1;
|
|
||||||
const x = (i / 140) * 1200 + r(1) * 10;
|
|
||||||
const h = 70 + r(2) * 150;
|
|
||||||
const lean = (r(3) - 0.5) * 60;
|
|
||||||
const shade = ['#2f7a1f', '#4c9a2a', '#6bb534', '#3d8a26', '#8cc63f', '#1f5e17'][Math.floor(r(4) * 6)];
|
|
||||||
return { d: `M${x.toFixed(1)} 260 Q ${(x + lean / 2).toFixed(1)} ${(260 - h / 2).toFixed(1)} ${(x + lean).toFixed(1)} ${(260 - h).toFixed(1)}`, shade, w: (3 + r(5) * 5).toFixed(1) };
|
|
||||||
});
|
|
||||||
const flowers = Array.from({ length: 14 }, (_, i) => ({ x: 40 + ((i * 197) % 1120), y: 90 + ((i * 61) % 110) }));
|
|
||||||
---
|
---
|
||||||
|
|
||||||
<Base title="About" description="About Johan Sandoval: background, skills and experience." theme="garden">
|
<Base title="About" description="About Johan Sandoval: background, skills and experience." theme="garden">
|
||||||
<section class="hero">
|
<section class="hero">
|
||||||
<svg class="grass" viewBox="0 0 1200 260" preserveAspectRatio="xMidYMax slice" aria-hidden="true">
|
<Image class="hero-img" src={daisies} alt="" widths={[640, 960]} sizes="100vw" loading="eager" />
|
||||||
<rect width="1200" height="260" fill="#3f8a22" />
|
|
||||||
{blades.map((b) => <path d={b.d} stroke={b.shade} stroke-width={b.w} fill="none" stroke-linecap="round" />)}
|
|
||||||
{
|
|
||||||
flowers.map((f) => (
|
|
||||||
<g transform={`translate(${f.x} ${f.y})`}>
|
|
||||||
<circle r="6" fill="#fffdf5" />
|
|
||||||
<circle r="2.4" fill="#ffd31a" />
|
|
||||||
</g>
|
|
||||||
))
|
|
||||||
}
|
|
||||||
</svg>
|
|
||||||
<div class="wrap intro">
|
<div class="wrap intro">
|
||||||
<h1>about me<sup>*</sup></h1>
|
<h1>about me<sup>*</sup></h1>
|
||||||
<p class="tagline">software engineer in chicago. i like building useful things.</p>
|
<p class="tagline">software engineer in chicago. i like building useful things.</p>
|
||||||
@@ -86,7 +76,8 @@ const flowers = Array.from({ length: 14 }, (_, i) => ({ x: 40 + ((i * 197) % 112
|
|||||||
<div class="strip"><div class="wrap">Automation, internal tools and web apps, plus games, 3D, hardware and music on the side.</div></div>
|
<div class="strip"><div class="wrap">Automation, internal tools and web apps, plus games, 3D, hardware and music on the side.</div></div>
|
||||||
|
|
||||||
<section class="wrap section intro-grid">
|
<section class="wrap section intro-grid">
|
||||||
<div class="blob prose">
|
<Clipping class="polaroid" src={marinaRiver} alt="Marina City and the Chicago River" ratio="1 / 1" rotate={4} tape="top" caption="Home base: Chicago, IL" widths={[300, 500]} sizes="(min-width: 52rem) 18rem, 60vw" />
|
||||||
|
<div class="blob prose" data-reveal>
|
||||||
<p>
|
<p>
|
||||||
I'm a deployment technical lead who builds the tooling the deployments run on. Over two
|
I'm a deployment technical lead who builds the tooling the deployments run on. Over two
|
||||||
years and 16,000+ devices across healthcare, higher-ed, agriculture and hospitality, I wrote
|
years and 16,000+ devices across healthcare, higher-ed, agriculture and hospitality, I wrote
|
||||||
@@ -110,11 +101,12 @@ const flowers = Array.from({ length: 14 }, (_, i) => ({ x: 40 + ((i * 197) % 112
|
|||||||
|
|
||||||
<section class="wrap section">
|
<section class="wrap section">
|
||||||
<h2>skills</h2>
|
<h2>skills</h2>
|
||||||
<ul class="packets">
|
<ul class="packets" data-reveal data-reveal-stagger>
|
||||||
{
|
{
|
||||||
skills.map((s, i) => (
|
skills.map((s, i) => (
|
||||||
<li class="packet" style={`--rot:${[-2, 1.5, -1, 2, -1.5][i % 5]}deg`}>
|
<li class="packet" style={`--rot:${[-2, 1.5, -1, 2, -1.5][i % 5]}deg`}>
|
||||||
<span class="kit">skill set</span>
|
<span class="kit">skill set · no.{String(i + 1).padStart(2, '0')}</span>
|
||||||
|
<Image class="window" src={packetPhotos[i % packetPhotos.length]} alt="" widths={[240, 400]} sizes="(min-width: 52rem) 14rem, 80vw" />
|
||||||
<h3>{s.k}</h3>
|
<h3>{s.k}</h3>
|
||||||
<ul>
|
<ul>
|
||||||
{s.v.map((v) => (
|
{s.v.map((v) => (
|
||||||
@@ -130,7 +122,7 @@ const flowers = Array.from({ length: 14 }, (_, i) => ({ x: 40 + ((i * 197) % 112
|
|||||||
|
|
||||||
<section class="wrap section">
|
<section class="wrap section">
|
||||||
<h2>experience</h2>
|
<h2>experience</h2>
|
||||||
<ol class="timeline">
|
<ol class="timeline" data-reveal data-reveal-stagger>
|
||||||
{
|
{
|
||||||
timeline.map((t) => (
|
timeline.map((t) => (
|
||||||
<li>
|
<li>
|
||||||
@@ -161,15 +153,31 @@ const flowers = Array.from({ length: 14 }, (_, i) => ({ x: 40 + ((i * 197) % 112
|
|||||||
display: grid;
|
display: grid;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
}
|
}
|
||||||
.grass {
|
.hero :global(.hero-img) {
|
||||||
position: absolute;
|
position: absolute;
|
||||||
inset: 0;
|
inset: 0;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
height: 100%;
|
height: 100%;
|
||||||
|
object-fit: cover;
|
||||||
|
object-position: center 60%;
|
||||||
|
animation: zoom 14s ease-out both;
|
||||||
|
}
|
||||||
|
@keyframes zoom {
|
||||||
|
from {
|
||||||
|
transform: scale(1.12);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.hero::after {
|
||||||
|
content: '';
|
||||||
|
position: absolute;
|
||||||
|
inset: 0;
|
||||||
|
background: linear-gradient(to top, rgb(10 30 5 / 0.55), transparent 65%);
|
||||||
}
|
}
|
||||||
.intro {
|
.intro {
|
||||||
position: relative;
|
position: relative;
|
||||||
padding-block: var(--space-8);
|
z-index: 1;
|
||||||
|
align-self: end;
|
||||||
|
padding-block: var(--space-8) var(--space-6);
|
||||||
}
|
}
|
||||||
h1 {
|
h1 {
|
||||||
font-size: clamp(4.5rem, 15vw, 11rem);
|
font-size: clamp(4.5rem, 15vw, 11rem);
|
||||||
@@ -197,18 +205,35 @@ const flowers = Array.from({ length: 14 }, (_, i) => ({ x: 40 + ((i * 197) % 112
|
|||||||
font-family: var(--ff-grotesk);
|
font-family: var(--ff-grotesk);
|
||||||
font-stretch: 112%;
|
font-stretch: 112%;
|
||||||
font-size: 0.95rem;
|
font-size: 0.95rem;
|
||||||
white-space: nowrap;
|
|
||||||
overflow: hidden;
|
|
||||||
text-overflow: ellipsis;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.intro-grid {
|
||||||
|
display: grid;
|
||||||
|
gap: var(--space-6);
|
||||||
|
justify-items: center;
|
||||||
|
}
|
||||||
|
.intro-grid :global(.polaroid) {
|
||||||
|
width: min(70%, 18rem);
|
||||||
|
}
|
||||||
|
@media (min-width: 60rem) {
|
||||||
|
.blob {
|
||||||
|
border-radius: 48% 52% 46% 54% / 12% 10% 14% 12%;
|
||||||
|
}
|
||||||
|
.intro-grid {
|
||||||
|
grid-template-columns: 18rem 1fr;
|
||||||
|
align-items: center;
|
||||||
|
}
|
||||||
|
.intro-grid :global(.polaroid) {
|
||||||
|
width: 100%;
|
||||||
|
}
|
||||||
|
}
|
||||||
.blob {
|
.blob {
|
||||||
max-width: 52rem;
|
max-width: 52rem;
|
||||||
margin-inline: auto;
|
margin-inline: auto;
|
||||||
padding: clamp(1.75rem, 5vw, 3.5rem);
|
padding: clamp(1.75rem, 5vw, 3.5rem);
|
||||||
background: var(--bg-raised);
|
background: var(--bg-raised);
|
||||||
border: 2px solid var(--fg);
|
border: 2px solid var(--fg);
|
||||||
border-radius: 48% 52% 46% 54% / 12% 10% 14% 12%;
|
border-radius: 2.5rem 3rem 2rem 3.5rem;
|
||||||
font-size: var(--step-1);
|
font-size: var(--step-1);
|
||||||
}
|
}
|
||||||
.blob a {
|
.blob a {
|
||||||
@@ -251,6 +276,13 @@ const flowers = Array.from({ length: 14 }, (_, i) => ({ x: 40 + ((i * 197) % 112
|
|||||||
text-transform: uppercase;
|
text-transform: uppercase;
|
||||||
color: var(--fg-muted);
|
color: var(--fg-muted);
|
||||||
}
|
}
|
||||||
|
.packet :global(.window) {
|
||||||
|
width: 100%;
|
||||||
|
aspect-ratio: 16 / 9;
|
||||||
|
object-fit: cover;
|
||||||
|
border: 2px solid var(--fg);
|
||||||
|
border-radius: 999px 999px 8px 8px;
|
||||||
|
}
|
||||||
.packet h3 {
|
.packet h3 {
|
||||||
font-size: var(--step-2);
|
font-size: var(--step-2);
|
||||||
color: var(--accent);
|
color: var(--accent);
|
||||||
|
|||||||
@@ -1,7 +1,17 @@
|
|||||||
---
|
---
|
||||||
import { getCollection } from 'astro:content';
|
import { getCollection } from 'astro:content';
|
||||||
|
import { getImage } from 'astro:assets';
|
||||||
import Base from '../../layouts/Base.astro';
|
import Base from '../../layouts/Base.astro';
|
||||||
import Window from '../../components/deco/Window.astro';
|
import Window from '../../components/deco/Window.astro';
|
||||||
|
import Clipping from '../../components/deco/Clipping.astro';
|
||||||
|
import ScrambledText from '../../components/bits/ScrambledText';
|
||||||
|
import forest from '../../assets/photos/forest.jpg';
|
||||||
|
import tv from '../../assets/photos/tv.jpg';
|
||||||
|
import floppies from '../../assets/photos/floppies-sticker.png';
|
||||||
|
|
||||||
|
// Tiny version of a real photo, scaled up with crisp pixels = instant pixel art.
|
||||||
|
const pixelForest = await getImage({ src: forest, width: 128, format: 'png' });
|
||||||
|
const floppy = await getImage({ src: floppies, width: 280, format: 'webp' });
|
||||||
|
|
||||||
const posts = (await getCollection('blog', ({ data }) => import.meta.env.DEV || !data.draft)).sort(
|
const posts = (await getCollection('blog', ({ data }) => import.meta.env.DEV || !data.draft)).sort(
|
||||||
(a, b) => +b.data.date - +a.data.date,
|
(a, b) => +b.data.date - +a.data.date,
|
||||||
@@ -12,19 +22,31 @@ const fmt = (d: Date) => d.toLocaleDateString('en-US', { month: 'short', day: 'n
|
|||||||
<Base title="Blog" description="Weekly notes from Johan Sandoval on what he's building." theme="desktop">
|
<Base title="Blog" description="Weekly notes from Johan Sandoval on what he's building." theme="desktop">
|
||||||
<section class="wrap section desk">
|
<section class="wrap section desk">
|
||||||
<div class="hero">
|
<div class="hero">
|
||||||
|
<Window title="yoyos.sh — Blog" class="wall-win">
|
||||||
|
<div class="wall" style={`background-image:url(${pixelForest.src})`}>
|
||||||
<div class="loading" aria-hidden="true">
|
<div class="loading" aria-hidden="true">
|
||||||
<span class="bar"><i></i></span>
|
<span class="bar"><i></i></span>
|
||||||
<span>Loading…</span>
|
<span>Loading…</span>
|
||||||
</div>
|
</div>
|
||||||
<h1>Blog</h1>
|
<h1>Blog</h1>
|
||||||
<p class="sub">
|
<div class="note">
|
||||||
Weekly notes on what I'm building: code, homelab, games, 3D and music.{' '}
|
<p class="note-title">Note</p>
|
||||||
<a href="/rss.xml">Subscribe via RSS</a>.
|
<ScrambledText client:visible className="note-text" radius={70} duration={1} speed={0.4} scrambleChars="░▒▓">
|
||||||
</p>
|
Weekly notes on what I'm building: code, homelab, games, 3D and music.
|
||||||
|
</ScrambledText>
|
||||||
|
<a class="rss" href="/rss.xml">Subscribe via RSS</a>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</Window>
|
||||||
|
|
||||||
|
<div class="props" aria-hidden="true">
|
||||||
|
<Clipping src={tv} ratio="1 / 1" position="center 70%" rotate={4} tape="top" widths={[260, 420]} sizes="40vw" class="tv" />
|
||||||
|
<img class="floppy" src={floppy.src} width={floppy.attributes.width} height={floppy.attributes.height} alt="" loading="lazy" />
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<Window title={`C:\\yoyos\\blog — ${posts.length} ${posts.length === 1 ? 'post' : 'posts'}`} class="list">
|
<Window title={`C:\\yoyos\\blog — ${posts.length} ${posts.length === 1 ? 'post' : 'posts'}`} class="list">
|
||||||
<ol class="posts">
|
<ol class="posts" data-reveal data-reveal-stagger>
|
||||||
{
|
{
|
||||||
posts.map((post) => (
|
posts.map((post) => (
|
||||||
<li>
|
<li>
|
||||||
@@ -41,9 +63,7 @@ const fmt = (d: Date) => d.toLocaleDateString('en-US', { month: 'short', day: 'n
|
|||||||
</span>
|
</span>
|
||||||
<time datetime={post.data.date.toISOString()}>{fmt(post.data.date)}</time>
|
<time datetime={post.data.date.toISOString()}>{fmt(post.data.date)}</time>
|
||||||
<span class="s">{post.data.summary}</span>
|
<span class="s">{post.data.summary}</span>
|
||||||
{post.data.tags.length > 0 && (
|
{post.data.tags.length > 0 && <span class="tags">{post.data.tags.map((t) => <span class="tag">{t}</span>)}</span>}
|
||||||
<span class="tags">{post.data.tags.map((t) => <span class="tag">{t}</span>)}</span>
|
|
||||||
)}
|
|
||||||
</a>
|
</a>
|
||||||
</li>
|
</li>
|
||||||
))
|
))
|
||||||
@@ -55,25 +75,45 @@ const fmt = (d: Date) => d.toLocaleDateString('en-US', { month: 'short', day: 'n
|
|||||||
|
|
||||||
<style>
|
<style>
|
||||||
.desk {
|
.desk {
|
||||||
background:
|
background: radial-gradient(circle, color-mix(in oklab, var(--cobalt) 18%, transparent) 1px, transparent 1.4px) 0 0 / 14px 14px;
|
||||||
radial-gradient(circle, color-mix(in oklab, var(--cobalt) 18%, transparent) 1px, transparent 1.4px) 0 0 / 14px 14px;
|
|
||||||
}
|
}
|
||||||
.hero {
|
.hero {
|
||||||
|
position: relative;
|
||||||
display: grid;
|
display: grid;
|
||||||
gap: var(--space-4);
|
gap: var(--space-5);
|
||||||
margin-bottom: var(--space-7);
|
margin-bottom: var(--space-7);
|
||||||
}
|
}
|
||||||
|
.hero :global(.wall-win .body) {
|
||||||
|
padding: 0;
|
||||||
|
}
|
||||||
|
.wall {
|
||||||
|
position: relative;
|
||||||
|
display: grid;
|
||||||
|
align-content: end;
|
||||||
|
gap: var(--space-4);
|
||||||
|
min-height: clamp(22rem, 95vw, 32rem);
|
||||||
|
padding: var(--space-4);
|
||||||
|
background-size: cover;
|
||||||
|
background-position: center 30%;
|
||||||
|
image-rendering: pixelated;
|
||||||
|
}
|
||||||
.loading {
|
.loading {
|
||||||
|
position: absolute;
|
||||||
|
top: var(--space-4);
|
||||||
|
left: var(--space-4);
|
||||||
display: flex;
|
display: flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
gap: var(--space-3);
|
gap: var(--space-2);
|
||||||
|
padding: 0.3rem 0.5rem;
|
||||||
|
background: #fbfcf6;
|
||||||
|
border: 2px solid var(--cobalt);
|
||||||
font-family: var(--ff-pixel);
|
font-family: var(--ff-pixel);
|
||||||
font-size: 0.85rem;
|
font-size: 0.8rem;
|
||||||
color: var(--cobalt);
|
color: var(--cobalt);
|
||||||
}
|
}
|
||||||
.bar {
|
.bar {
|
||||||
width: 12rem;
|
width: 7rem;
|
||||||
height: 1rem;
|
height: 0.9rem;
|
||||||
padding: 2px;
|
padding: 2px;
|
||||||
border: 2px solid var(--cobalt);
|
border: 2px solid var(--cobalt);
|
||||||
}
|
}
|
||||||
@@ -81,8 +121,8 @@ const fmt = (d: Date) => d.toLocaleDateString('en-US', { month: 'short', day: 'n
|
|||||||
display: block;
|
display: block;
|
||||||
height: 100%;
|
height: 100%;
|
||||||
width: 0;
|
width: 0;
|
||||||
background: repeating-linear-gradient(90deg, var(--cobalt) 0 10px, transparent 10px 12px);
|
background: repeating-linear-gradient(90deg, var(--cobalt) 0 8px, transparent 8px 10px);
|
||||||
animation: load 1.6s steps(12) forwards;
|
animation: load 1.8s steps(10) forwards;
|
||||||
}
|
}
|
||||||
@keyframes load {
|
@keyframes load {
|
||||||
to {
|
to {
|
||||||
@@ -90,23 +130,82 @@ const fmt = (d: Date) => d.toLocaleDateString('en-US', { month: 'short', day: 'n
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
h1 {
|
h1 {
|
||||||
font-size: clamp(4rem, 14vw, 9rem);
|
font-size: clamp(4.5rem, 24vw, 10rem);
|
||||||
line-height: 0.9;
|
line-height: 0.85;
|
||||||
|
color: #fff;
|
||||||
|
text-shadow:
|
||||||
|
4px 4px 0 var(--cobalt),
|
||||||
|
8px 8px 0 #10172e;
|
||||||
|
}
|
||||||
|
.note {
|
||||||
|
max-width: 30rem;
|
||||||
|
padding: 0.75rem 0.9rem;
|
||||||
|
background: #fbfcf6;
|
||||||
|
border: 2px solid var(--cobalt);
|
||||||
|
box-shadow: 4px 4px 0 #10172e;
|
||||||
|
}
|
||||||
|
.note-title {
|
||||||
|
margin: -0.75rem -0.9rem 0.5rem;
|
||||||
|
padding: 0.15rem 0.6rem;
|
||||||
|
background: var(--cobalt);
|
||||||
|
color: #fff;
|
||||||
|
font-family: var(--ff-pixel);
|
||||||
|
font-size: 0.85rem;
|
||||||
|
}
|
||||||
|
.note :global(.note-text) {
|
||||||
|
margin: 0;
|
||||||
|
max-width: none;
|
||||||
|
font-family: var(--ff-pixel);
|
||||||
|
font-size: 1.05rem;
|
||||||
|
line-height: 1.45;
|
||||||
|
color: #10172e;
|
||||||
|
}
|
||||||
|
.rss {
|
||||||
|
display: inline-block;
|
||||||
|
margin-top: 0.4rem;
|
||||||
|
font-family: var(--ff-pixel);
|
||||||
color: var(--cobalt);
|
color: var(--cobalt);
|
||||||
text-shadow: 5px 5px 0 var(--lime);
|
|
||||||
}
|
}
|
||||||
.sub {
|
.props {
|
||||||
max-width: 52ch;
|
position: relative;
|
||||||
font-size: var(--step-1);
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
gap: var(--space-4);
|
||||||
}
|
}
|
||||||
|
.props :global(.tv) {
|
||||||
|
width: 46%;
|
||||||
|
max-width: 15rem;
|
||||||
|
}
|
||||||
|
.floppy {
|
||||||
|
width: 40%;
|
||||||
|
max-width: 13rem;
|
||||||
|
height: auto;
|
||||||
|
rotate: -10deg;
|
||||||
|
filter: drop-shadow(3px 5px 4px rgb(0 0 0 / 0.3));
|
||||||
|
}
|
||||||
|
@media (min-width: 60rem) {
|
||||||
|
.hero {
|
||||||
|
grid-template-columns: 1fr 17rem;
|
||||||
|
align-items: center;
|
||||||
|
}
|
||||||
|
.props {
|
||||||
|
flex-direction: column;
|
||||||
|
}
|
||||||
|
.props :global(.tv),
|
||||||
|
.floppy {
|
||||||
|
width: 100%;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
.posts {
|
.posts {
|
||||||
list-style: none;
|
list-style: none;
|
||||||
padding: 0;
|
padding: 0;
|
||||||
}
|
}
|
||||||
.posts a {
|
.posts a {
|
||||||
display: grid;
|
display: grid;
|
||||||
grid-template-columns: auto 1fr auto;
|
grid-template-columns: auto 1fr;
|
||||||
gap: 0.25rem var(--space-4);
|
gap: 0.25rem var(--space-3);
|
||||||
padding: var(--space-4);
|
padding: var(--space-4);
|
||||||
border-bottom: 1px dashed var(--line);
|
border-bottom: 1px dashed var(--line);
|
||||||
text-decoration: none;
|
text-decoration: none;
|
||||||
@@ -115,6 +214,7 @@ const fmt = (d: Date) => d.toLocaleDateString('en-US', { month: 'short', day: 'n
|
|||||||
border-bottom: 0;
|
border-bottom: 0;
|
||||||
}
|
}
|
||||||
.posts a:hover,
|
.posts a:hover,
|
||||||
|
.posts a:active,
|
||||||
.posts a:focus-visible {
|
.posts a:focus-visible {
|
||||||
background: var(--cobalt);
|
background: var(--cobalt);
|
||||||
color: #fff;
|
color: #fff;
|
||||||
@@ -124,44 +224,44 @@ const fmt = (d: Date) => d.toLocaleDateString('en-US', { month: 'short', day: 'n
|
|||||||
color: #fff;
|
color: #fff;
|
||||||
}
|
}
|
||||||
.icon {
|
.icon {
|
||||||
grid-row: span 3;
|
grid-row: span 4;
|
||||||
width: 2rem;
|
width: 2rem;
|
||||||
color: var(--cobalt);
|
color: var(--cobalt);
|
||||||
}
|
}
|
||||||
.posts a:hover .icon {
|
|
||||||
color: var(--ink);
|
|
||||||
}
|
|
||||||
.t {
|
.t {
|
||||||
font-family: var(--ff-pixel);
|
font-family: var(--ff-pixel);
|
||||||
font-size: var(--step-2);
|
font-size: clamp(1.35rem, 5.5vw, 2rem);
|
||||||
line-height: 1.1;
|
line-height: 1.15;
|
||||||
}
|
}
|
||||||
time {
|
time {
|
||||||
font-family: var(--ff-pixel);
|
font-family: var(--ff-pixel);
|
||||||
color: var(--fg-muted);
|
color: var(--fg-muted);
|
||||||
white-space: nowrap;
|
|
||||||
}
|
}
|
||||||
.s {
|
.s {
|
||||||
grid-column: 2 / -1;
|
|
||||||
color: var(--fg-muted);
|
color: var(--fg-muted);
|
||||||
}
|
}
|
||||||
.tags {
|
.tags {
|
||||||
grid-column: 2 / -1;
|
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-wrap: wrap;
|
flex-wrap: wrap;
|
||||||
gap: 4px;
|
gap: 4px;
|
||||||
}
|
}
|
||||||
.list :global(.body) {
|
.desk :global(.list .body) {
|
||||||
padding: 0;
|
padding: 0;
|
||||||
}
|
}
|
||||||
@media (max-width: 40rem) {
|
@media (min-width: 52rem) {
|
||||||
.posts a {
|
.posts a {
|
||||||
grid-template-columns: auto 1fr;
|
grid-template-columns: auto 1fr auto;
|
||||||
|
}
|
||||||
|
.icon {
|
||||||
|
grid-row: span 3;
|
||||||
|
}
|
||||||
|
time {
|
||||||
|
grid-column: 3;
|
||||||
|
grid-row: 1;
|
||||||
}
|
}
|
||||||
time,
|
|
||||||
.s,
|
.s,
|
||||||
.tags {
|
.tags {
|
||||||
grid-column: 2;
|
grid-column: 2 / -1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
@@ -2,12 +2,22 @@
|
|||||||
import Base from '../layouts/Base.astro';
|
import Base from '../layouts/Base.astro';
|
||||||
import Stamp from '../components/deco/Stamp.astro';
|
import Stamp from '../components/deco/Stamp.astro';
|
||||||
import { SITE } from '../lib/site';
|
import { SITE } from '../lib/site';
|
||||||
|
import { Image, getImage } from 'astro:assets';
|
||||||
|
import aerial from '../assets/photos/chicago-aerial.jpg';
|
||||||
|
import botanical from '../assets/photos/botanical.jpg';
|
||||||
|
import back from '../assets/photos/postcard-back.jpg';
|
||||||
const year = new Date().getFullYear();
|
const year = new Date().getFullYear();
|
||||||
|
const aerialBg = await getImage({ src: aerial, width: 900, format: 'webp' });
|
||||||
|
const backBg = await getImage({ src: back, width: 1200, format: 'webp' });
|
||||||
---
|
---
|
||||||
|
|
||||||
<Base title="Contact" description="Hire Johan Sandoval or get in touch." theme="postcard">
|
<Base title="Contact" description="Hire Johan Sandoval or get in touch." theme="postcard">
|
||||||
<section class="wrap section layout">
|
<section class="wrap section layout">
|
||||||
<div class="side stack">
|
<div class="side stack">
|
||||||
|
<div class="greetings" aria-hidden="true" data-reveal="tilt">
|
||||||
|
<span class="from">Greetings from</span>
|
||||||
|
<span class="city" style={`background-image:url(${aerialBg.src})`}>Chicago</span>
|
||||||
|
</div>
|
||||||
<h1>Get in touch</h1>
|
<h1>Get in touch</h1>
|
||||||
<p class="lead">
|
<p class="lead">
|
||||||
Hiring, freelance work, collaborations, or you want to talk about a game, a 3D model or a
|
Hiring, freelance work, collaborations, or you want to talk about a game, a 3D model or a
|
||||||
@@ -25,7 +35,7 @@ const year = new Date().getFullYear();
|
|||||||
</dl>
|
</dl>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<form class="card" method="post" action="/api/contact">
|
<form class="card" method="post" action="/api/contact" style={`--back:url(${backBg.src})`}>
|
||||||
<div class="message">
|
<div class="message">
|
||||||
<p class="hello">Hi Johan,</p>
|
<p class="hello">Hi Johan,</p>
|
||||||
<label class="msg">
|
<label class="msg">
|
||||||
@@ -43,17 +53,10 @@ const year = new Date().getFullYear();
|
|||||||
<span>yoyos.sh</span>
|
<span>yoyos.sh</span>
|
||||||
</div>
|
</div>
|
||||||
<Stamp color="#fbf5e4" rotate={3} class="stamp">
|
<Stamp color="#fbf5e4" rotate={3} class="stamp">
|
||||||
<svg viewBox="0 0 80 96" aria-hidden="true">
|
<div class="stamp-art">
|
||||||
<rect width="80" height="96" fill="#3f78b8" />
|
<Image src={botanical} alt="" widths={[160, 240]} sizes="7rem" />
|
||||||
<path d="M10 90 C 30 60, 26 40, 52 18" stroke="#3a2a1c" stroke-width="3" fill="none" />
|
<span>26¢</span>
|
||||||
<path d="M34 52 C 44 50, 52 54, 62 46" stroke="#3a2a1c" stroke-width="2" fill="none" />
|
</div>
|
||||||
<g fill="#f2a0b8" stroke="#fbf5e4" stroke-width="1">
|
|
||||||
<circle cx="52" cy="18" r="7" /><circle cx="30" cy="44" r="6" /><circle cx="62" cy="46" r="6" />
|
|
||||||
<circle cx="22" cy="66" r="5" /><circle cx="44" cy="31" r="5" />
|
|
||||||
</g>
|
|
||||||
<g fill="#ffd31a"><circle cx="52" cy="18" r="2" /><circle cx="30" cy="44" r="2" /><circle cx="62" cy="46" r="2" /></g>
|
|
||||||
<text x="6" y="90" fill="#fbf5e4" font-family="Archivo Variable, sans-serif" font-weight="800" font-size="13">26¢</text>
|
|
||||||
</svg>
|
|
||||||
</Stamp>
|
</Stamp>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@@ -101,6 +104,44 @@ const year = new Date().getFullYear();
|
|||||||
.side {
|
.side {
|
||||||
--stack-gap: var(--space-5);
|
--stack-gap: var(--space-5);
|
||||||
}
|
}
|
||||||
|
.greetings {
|
||||||
|
position: relative;
|
||||||
|
display: grid;
|
||||||
|
justify-items: center;
|
||||||
|
padding: 1rem 0.75rem 1.1rem;
|
||||||
|
background: #fbf5e4;
|
||||||
|
border: 2px solid #142033;
|
||||||
|
box-shadow: var(--shadow);
|
||||||
|
rotate: -2deg;
|
||||||
|
color: #142033;
|
||||||
|
overflow: hidden;
|
||||||
|
}
|
||||||
|
.from {
|
||||||
|
font-family: var(--ff-grotesk);
|
||||||
|
font-style: italic;
|
||||||
|
font-weight: 700;
|
||||||
|
font-size: clamp(1rem, 4vw, 1.3rem);
|
||||||
|
padding: 0.05rem 0.6rem;
|
||||||
|
background: var(--yellow);
|
||||||
|
border: 2px solid #142033;
|
||||||
|
rotate: -3deg;
|
||||||
|
z-index: 1;
|
||||||
|
}
|
||||||
|
.city {
|
||||||
|
font-family: var(--ff-mag);
|
||||||
|
font-size: clamp(2.5rem, 13.5vw, 6.4rem);
|
||||||
|
line-height: 0.9;
|
||||||
|
letter-spacing: -0.04em;
|
||||||
|
max-width: 100%;
|
||||||
|
text-transform: uppercase;
|
||||||
|
color: transparent;
|
||||||
|
background-size: cover;
|
||||||
|
background-position: center;
|
||||||
|
-webkit-background-clip: text;
|
||||||
|
background-clip: text;
|
||||||
|
-webkit-text-stroke: 2px #142033;
|
||||||
|
filter: drop-shadow(3px 3px 0 #e2321f);
|
||||||
|
}
|
||||||
h1 {
|
h1 {
|
||||||
font-size: clamp(3.25rem, 8vw, 6rem);
|
font-size: clamp(3.25rem, 8vw, 6rem);
|
||||||
line-height: 0.9;
|
line-height: 0.9;
|
||||||
@@ -115,7 +156,10 @@ const year = new Date().getFullYear();
|
|||||||
.card {
|
.card {
|
||||||
display: grid;
|
display: grid;
|
||||||
grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr);
|
grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr);
|
||||||
background: #fbf5e4;
|
background:
|
||||||
|
linear-gradient(color-mix(in oklab, #fbf5e4 72%, transparent), color-mix(in oklab, #fbf5e4 72%, transparent)),
|
||||||
|
var(--back) center / cover,
|
||||||
|
#fbf5e4;
|
||||||
color: #142033;
|
color: #142033;
|
||||||
border: 2px solid #142033;
|
border: 2px solid #142033;
|
||||||
box-shadow: var(--shadow);
|
box-shadow: var(--shadow);
|
||||||
@@ -199,6 +243,25 @@ const year = new Date().getFullYear();
|
|||||||
.address :global(.stamp) {
|
.address :global(.stamp) {
|
||||||
width: 6.25rem;
|
width: 6.25rem;
|
||||||
}
|
}
|
||||||
|
.stamp-art {
|
||||||
|
position: relative;
|
||||||
|
background: #fbf5e4;
|
||||||
|
}
|
||||||
|
.stamp-art :global(img) {
|
||||||
|
width: 100%;
|
||||||
|
aspect-ratio: 4 / 5;
|
||||||
|
object-fit: cover;
|
||||||
|
object-position: center 30%;
|
||||||
|
}
|
||||||
|
.stamp-art span {
|
||||||
|
position: absolute;
|
||||||
|
left: 4px;
|
||||||
|
bottom: 2px;
|
||||||
|
font-family: var(--ff-grotesk);
|
||||||
|
font-weight: 800;
|
||||||
|
font-size: 0.9rem;
|
||||||
|
color: #b0302a;
|
||||||
|
}
|
||||||
label {
|
label {
|
||||||
display: grid;
|
display: grid;
|
||||||
gap: 2px;
|
gap: 2px;
|
||||||
@@ -213,6 +276,8 @@ const year = new Date().getFullYear();
|
|||||||
input,
|
input,
|
||||||
select {
|
select {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
|
min-height: 44px;
|
||||||
|
font-size: 1rem;
|
||||||
padding: 0.35rem 0;
|
padding: 0.35rem 0;
|
||||||
border: 0;
|
border: 0;
|
||||||
border-bottom: 2px solid #142033;
|
border-bottom: 2px solid #142033;
|
||||||
@@ -227,7 +292,9 @@ const year = new Date().getFullYear();
|
|||||||
box-shadow: 0 2px 0 var(--cobalt);
|
box-shadow: 0 2px 0 var(--cobalt);
|
||||||
}
|
}
|
||||||
.send {
|
.send {
|
||||||
justify-self: start;
|
justify-self: stretch;
|
||||||
|
justify-content: center;
|
||||||
|
min-height: 48px;
|
||||||
margin-top: var(--space-3);
|
margin-top: var(--space-3);
|
||||||
--btn-bg: #142033;
|
--btn-bg: #142033;
|
||||||
--btn-fg: #fbf5e4;
|
--btn-fg: #fbf5e4;
|
||||||
|
|||||||
@@ -0,0 +1,53 @@
|
|||||||
|
---
|
||||||
|
import Base from '../layouts/Base.astro';
|
||||||
|
import credits from '../data/photo-credits.json';
|
||||||
|
---
|
||||||
|
|
||||||
|
<Base title="Photo credits" description="Sources and licenses for the photos used on yoyos.sh." theme="spec">
|
||||||
|
<section class="wrap section">
|
||||||
|
<h1>Photo credits</h1>
|
||||||
|
<p class="muted intro">
|
||||||
|
The photos and textures on this site are public domain (CC0 or Public Domain Mark), found
|
||||||
|
through <a href="https://openverse.org">Openverse</a>. No attribution is required, but
|
||||||
|
credit where it's due.
|
||||||
|
</p>
|
||||||
|
<ul class="list">
|
||||||
|
{
|
||||||
|
credits.map((c) => (
|
||||||
|
<li>
|
||||||
|
<a href={c.url} rel="noopener">{c.title.replace(/^File:/, '').replace(/\.\w+$/, '')}</a>
|
||||||
|
<span>
|
||||||
|
{c.creator} · {c.source} · {c.license}
|
||||||
|
</span>
|
||||||
|
</li>
|
||||||
|
))
|
||||||
|
}
|
||||||
|
</ul>
|
||||||
|
</section>
|
||||||
|
</Base>
|
||||||
|
|
||||||
|
<style>
|
||||||
|
h1 {
|
||||||
|
font-size: clamp(2.6rem, 10vw, 5rem);
|
||||||
|
}
|
||||||
|
.intro {
|
||||||
|
max-width: 60ch;
|
||||||
|
margin-block: var(--space-4) var(--space-6);
|
||||||
|
}
|
||||||
|
.list {
|
||||||
|
list-style: none;
|
||||||
|
padding: 0;
|
||||||
|
border-top: 1px solid var(--line-strong);
|
||||||
|
}
|
||||||
|
.list li {
|
||||||
|
display: grid;
|
||||||
|
gap: 0.15rem;
|
||||||
|
padding-block: var(--space-3);
|
||||||
|
border-bottom: 1px solid var(--line);
|
||||||
|
}
|
||||||
|
.list span {
|
||||||
|
font-family: var(--font-mono);
|
||||||
|
font-size: 0.78rem;
|
||||||
|
color: var(--fg-muted);
|
||||||
|
}
|
||||||
|
</style>
|
||||||
@@ -1,13 +1,32 @@
|
|||||||
---
|
---
|
||||||
import { getCollection } from 'astro:content';
|
import { getCollection } from 'astro:content';
|
||||||
|
import { getImage } from 'astro:assets';
|
||||||
import Base from '../layouts/Base.astro';
|
import Base from '../layouts/Base.astro';
|
||||||
import ProjectCard from '../components/ProjectCard.astro';
|
import ProjectCard from '../components/ProjectCard.astro';
|
||||||
import LineBadge from '../components/LineBadge.astro';
|
import LineBadge from '../components/LineBadge.astro';
|
||||||
|
import ChicagoStar from '../components/ChicagoStar.astro';
|
||||||
import Starburst from '../components/deco/Starburst.astro';
|
import Starburst from '../components/deco/Starburst.astro';
|
||||||
import Barcode from '../components/deco/Barcode.astro';
|
import Barcode from '../components/deco/Barcode.astro';
|
||||||
|
import Clipping from '../components/deco/Clipping.astro';
|
||||||
|
import ScrollVelocity from '../components/bits/ScrollVelocity';
|
||||||
|
import CircularText from '../components/bits/CircularText';
|
||||||
|
import CountUp from '../components/bits/CountUp';
|
||||||
|
import StickerPeel from '../components/bits/StickerPeel';
|
||||||
import { SITE } from '../lib/site';
|
import { SITE } from '../lib/site';
|
||||||
import { DISCIPLINES, LINES } from '../lib/disciplines';
|
import { DISCIPLINES, LINES } from '../lib/disciplines';
|
||||||
|
|
||||||
|
import skyline from '../assets/photos/chicago-skyline-red.jpg';
|
||||||
|
import ctaSign from '../assets/photos/cta-sign.jpg';
|
||||||
|
import marina from '../assets/photos/marina-city.jpg';
|
||||||
|
import cassette from '../assets/photos/cassette.jpg';
|
||||||
|
import guitar from '../assets/photos/guitar-strat.jpg';
|
||||||
|
import moto from '../assets/photos/motorcycle.jpg';
|
||||||
|
import gba from '../assets/photos/gba-sticker.png';
|
||||||
|
import floppies from '../assets/photos/floppies-sticker.png';
|
||||||
|
|
||||||
|
const gbaSticker = await getImage({ src: gba, width: 360, format: 'webp' });
|
||||||
|
const floppySticker = await getImage({ src: floppies, width: 320, format: 'webp' });
|
||||||
|
|
||||||
const work = (await getCollection('work')).sort(
|
const work = (await getCollection('work')).sort(
|
||||||
(a, b) => Number(b.data.featured) - Number(a.data.featured) || +b.data.date - +a.data.date,
|
(a, b) => Number(b.data.featured) - Number(a.data.featured) || +b.data.date - +a.data.date,
|
||||||
);
|
);
|
||||||
@@ -15,75 +34,153 @@ const selected = work.slice(0, 6);
|
|||||||
const posts = (await getCollection('blog', ({ data }) => !data.draft))
|
const posts = (await getCollection('blog', ({ data }) => !data.draft))
|
||||||
.sort((a, b) => +b.data.date - +a.data.date)
|
.sort((a, b) => +b.data.date - +a.data.date)
|
||||||
.slice(0, 3);
|
.slice(0, 3);
|
||||||
|
|
||||||
const counts = Object.fromEntries(
|
const counts = Object.fromEntries(
|
||||||
DISCIPLINES.map((d) => [d, work.filter((p) => p.data.disciplines.includes(d)).length]),
|
DISCIPLINES.map((d) => [d, work.filter((p) => p.data.disciplines.includes(d)).length]),
|
||||||
);
|
);
|
||||||
const fmt = (d: Date) => d.toLocaleDateString('en-US', { month: 'short', day: 'numeric', year: 'numeric' });
|
const fmt = (d: Date) => d.toLocaleDateString('en-US', { month: 'short', day: 'numeric', year: 'numeric' });
|
||||||
const now = new Date();
|
const now = new Date();
|
||||||
const season = ['Winter', 'Spring', 'Summer', 'Fall'][Math.floor(((now.getMonth() + 1) % 12) / 3)];
|
const season = ['Winter', 'Spring', 'Summer', 'Fall'][Math.floor(((now.getMonth() + 1) % 12) / 3)];
|
||||||
|
const issue = String(now.getMonth() + 1).padStart(2, '0');
|
||||||
---
|
---
|
||||||
|
|
||||||
<Base>
|
<Base>
|
||||||
<!-- ===== Cover ===== -->
|
<!-- ================= COVER ================= -->
|
||||||
<section class="cover wrap">
|
<section class="cover">
|
||||||
<div class="masthead">
|
<div class="wrap cover-in">
|
||||||
<span>Portfolio · {season} {now.getFullYear()}</span>
|
<header class="masthead">
|
||||||
<span>{SITE.location}</span>
|
<p class="logo" aria-hidden="true">YOYOS<span>.sh</span></p>
|
||||||
|
<div class="issue">
|
||||||
|
<span>No.{issue}</span>
|
||||||
|
<span>{season} {now.getFullYear()}</span>
|
||||||
<span class="price">Free</span>
|
<span class="price">Free</span>
|
||||||
</div>
|
</div>
|
||||||
|
</header>
|
||||||
|
|
||||||
<h1 class="title">
|
<div class="hero">
|
||||||
<span class="l1">Johan</span>
|
<Clipping
|
||||||
<span class="l2">Sandoval</span>
|
class="hero-photo"
|
||||||
|
src={skyline}
|
||||||
|
alt="Chicago skyline silhouetted against a red sunset"
|
||||||
|
ratio="4 / 3.4"
|
||||||
|
position="center 40%"
|
||||||
|
loading="eager"
|
||||||
|
widths={[480, 800, 1200]}
|
||||||
|
sizes="(min-width: 60rem) 55vw, 100vw"
|
||||||
|
rotate={-1.5}
|
||||||
|
tape="top"
|
||||||
|
/>
|
||||||
|
|
||||||
|
<h1 class="name">
|
||||||
|
<span class="first">Johan</span>
|
||||||
|
<span class="last">Sandoval</span>
|
||||||
</h1>
|
</h1>
|
||||||
<p class="kana" aria-hidden="true">ジョハン・サンドバル</p>
|
|
||||||
|
|
||||||
<Starburst class="burst" color="var(--yellow)" size="clamp(7.5rem, 14vw, 11rem)" rotate={12}>
|
<p class="role-tag">Software Engineer</p>
|
||||||
{SITE.availability.open ? 'Open to work!' : 'Say hi!'}
|
|
||||||
</Starburst>
|
<div class="badge" aria-hidden="true">
|
||||||
|
<CircularText client:visible text="OPEN TO WORK ★ CHICAGO IL ★ " spinDuration={18} onHover="speedUp" className="badge-ring" />
|
||||||
|
<ChicagoStar size="2.4rem" class="badge-star" />
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="sticker sticker-gba" aria-hidden="true">
|
||||||
|
<StickerPeel client:visible imageSrc={gbaSticker.src} width={150} rotate={-8} peelDirection={20} shadowIntensity={0.45} lightingIntensity={0.08} />
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
<div class="deck">
|
<div class="deck">
|
||||||
<p class="role">Software engineer<br />building internal tools, automation & web apps.</p>
|
|
||||||
<p class="lede">
|
<p class="lede">
|
||||||
I make the software operations teams run on: dashboards, deployment tooling and the APIs
|
I build the software operations teams run on: <mark>dashboards</mark>, deployment tooling and
|
||||||
behind them. On the side I make games, 3D models, hardware and music.
|
the APIs behind them. Off the clock I make games, 3D models, hardware and music.
|
||||||
</p>
|
</p>
|
||||||
<div class="cluster">
|
<div class="cta">
|
||||||
<a class="btn btn--primary" href="/work">See my work</a>
|
<a class="btn btn--primary" href="/work">See my work</a>
|
||||||
<a class="btn" href="/contact">Hire me</a>
|
<a class="btn" href="/contact">Hire me</a>
|
||||||
<a class="btn" href={SITE.resume}>Résumé (PDF)</a>
|
<a class="btn" href={SITE.resume}>Résumé</a>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<ul class="stats" aria-label="Highlights">
|
<ul class="coverlines">
|
||||||
<li style="--c: var(--lime)"><b>16,000+</b> devices deployed with my tooling</li>
|
<li class="cl cl-1">
|
||||||
<li style="--c: var(--pink)"><b>10 → 25</b> daily builds after shipping USMT Dash</li>
|
<a href="/work/usmt-dash">
|
||||||
<li style="--c: var(--sky)"><b>2 yrs</b> as technical lead on enterprise rollouts</li>
|
<span class="big">10 → 25</span>
|
||||||
|
daily builds after shipping USMT Dash
|
||||||
|
<span class="pg">p.01</span>
|
||||||
|
</a>
|
||||||
|
</li>
|
||||||
|
<li class="cl cl-2">
|
||||||
|
<span class="big">Self-hosted</span>
|
||||||
|
this site runs on my own servers, deployed from git
|
||||||
|
</li>
|
||||||
|
<li class="cl cl-3">
|
||||||
|
<a href="/music"><span class="big">Also inside</span> games, 3D, hardware & guitar <span class="pg">p.04</span></a>
|
||||||
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
|
|
||||||
<div class="corner">
|
<Starburst class="burst" color="var(--cta-yellow)" size="clamp(6.5rem, 22vw, 9.5rem)" rotate={10}>
|
||||||
<Barcode value="YOYOS.SH-2026" />
|
{SITE.availability.open ? 'Now hiring me!' : 'Say hi!'}
|
||||||
|
</Starburst>
|
||||||
|
|
||||||
|
<div class="barcode-wrap"><Barcode value="YOYOS.SH-2026" /></div>
|
||||||
</div>
|
</div>
|
||||||
</section>
|
</section>
|
||||||
|
|
||||||
<!-- ===== Selected work ===== -->
|
<!-- ================= TICKER ================= -->
|
||||||
<section class="wrap section">
|
<div class="ticker" aria-hidden="true">
|
||||||
<div class="head">
|
<ScrollVelocity
|
||||||
<h2><span class="hl" style="--c: var(--lime)">Selected work</span></h2>
|
client:visible
|
||||||
|
velocity={45}
|
||||||
|
numCopies={4}
|
||||||
|
texts={['Software Engineer ★ Internal Tools ★ Automation ★ Web Apps ★ ', 'Games ★ 3D ★ Hardware ★ Music ★ Chicago ★ ']}
|
||||||
|
className="ticker-text"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- ================= STATS + COLLAGE ================= -->
|
||||||
|
<section class="wrap section stats-wrap">
|
||||||
|
<div class="collage" aria-hidden="true">
|
||||||
|
<Clipping class="c-sign" src={ctaSign} ratio="4 / 5" position="45% center" rotate={-4} tape="corners" widths={[300, 500]} sizes="45vw" />
|
||||||
|
<Clipping class="c-marina" src={marina} ratio="3 / 4" rotate={5} tape="top" treatment="riso" ink="var(--cta-blue)" widths={[300, 500]} sizes="40vw" />
|
||||||
|
<Clipping class="c-cassette" src={cassette} ratio="16 / 10" rotate={-7} widths={[260, 420]} sizes="36vw" />
|
||||||
|
<div class="sticker sticker-floppy">
|
||||||
|
<StickerPeel client:visible imageSrc={floppySticker.src} width={130} rotate={12} peelDirection={-30} shadowIntensity={0.4} lightingIntensity={0.06} />
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="stats" data-reveal data-reveal-stagger>
|
||||||
|
<div class="stat" style="--c: var(--cta-yellow)">
|
||||||
|
<b><CountUp client:visible to={16000} separator="," duration={1.6} />+</b>
|
||||||
|
<span>devices deployed with tooling I wrote</span>
|
||||||
|
</div>
|
||||||
|
<div class="stat" style="--c: var(--cta-pink)">
|
||||||
|
<b><CountUp client:visible from={10} to={25} duration={1.4} /> / day</b>
|
||||||
|
<span>machine builds after shipping USMT Dash</span>
|
||||||
|
</div>
|
||||||
|
<div class="stat" style="--c: var(--chicago-blue)">
|
||||||
|
<b><CountUp client:visible to={1900} separator="," duration={1.6} /></b>
|
||||||
|
<span>machines closed against a 1,300 scope</span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</section>
|
||||||
|
|
||||||
|
<!-- ================= SELECTED WORK ================= -->
|
||||||
|
<section class="section work">
|
||||||
|
<div class="wrap head" data-reveal>
|
||||||
|
<h2><span class="hl" style="--c: var(--cta-yellow)">Selected work</span></h2>
|
||||||
<a class="more" href="/work">All projects →</a>
|
<a class="more" href="/work">All projects →</a>
|
||||||
</div>
|
</div>
|
||||||
<div class="grid">
|
<div class="rail" data-reveal data-reveal-stagger>
|
||||||
{selected.map((p, i) => <ProjectCard project={p} index={i + 1} />)}
|
{selected.map((p, i) => <ProjectCard project={p} index={i + 1} />)}
|
||||||
</div>
|
</div>
|
||||||
|
<p class="swipe wrap" aria-hidden="true">Swipe →</p>
|
||||||
</section>
|
</section>
|
||||||
|
|
||||||
<!-- ===== What I do ===== -->
|
<!-- ================= WHAT I DO ================= -->
|
||||||
<section class="wrap section">
|
<section class="wrap section">
|
||||||
<div class="head">
|
<div class="head" data-reveal>
|
||||||
<h2><span class="hl" style="--c: var(--sky)">What I work on</span></h2>
|
<h2><span class="hl" style="--c: var(--chicago-blue)">What I work on</span></h2>
|
||||||
</div>
|
</div>
|
||||||
<ul class="lines">
|
<div class="what">
|
||||||
|
<ul class="lines" data-reveal data-reveal-stagger>
|
||||||
{
|
{
|
||||||
DISCIPLINES.map((d) => (
|
DISCIPLINES.map((d) => (
|
||||||
<li style={`--c:${LINES[d].color}`}>
|
<li style={`--c:${LINES[d].color}`}>
|
||||||
@@ -91,23 +188,26 @@ const season = ['Winter', 'Spring', 'Summer', 'Fall'][Math.floor(((now.getMonth(
|
|||||||
<LineBadge d={d} size="2.4rem" />
|
<LineBadge d={d} size="2.4rem" />
|
||||||
<span class="lname">{LINES[d].label}</span>
|
<span class="lname">{LINES[d].label}</span>
|
||||||
<span class="track" aria-hidden="true" />
|
<span class="track" aria-hidden="true" />
|
||||||
<span class="count">
|
<span class="count">{counts[d]}</span>
|
||||||
{counts[d]} {counts[d] === 1 ? 'project' : 'projects'}
|
|
||||||
</span>
|
|
||||||
</a>
|
</a>
|
||||||
</li>
|
</li>
|
||||||
))
|
))
|
||||||
}
|
}
|
||||||
</ul>
|
</ul>
|
||||||
|
<div class="what-photos" aria-hidden="true">
|
||||||
|
<Clipping src={guitar} ratio="1 / 1" rotate={3} tape="top" treatment="duotone" ink="var(--cta-pink)" widths={[300, 500]} sizes="30vw" />
|
||||||
|
<Clipping src={moto} ratio="4 / 3" rotate={-4} treatment="halftone" widths={[300, 500]} sizes="30vw" data-parallax="0.2" />
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
</section>
|
</section>
|
||||||
|
|
||||||
<!-- ===== Blog ===== -->
|
<!-- ================= BLOG ================= -->
|
||||||
<section class="wrap section">
|
<section class="wrap section">
|
||||||
<div class="head">
|
<div class="head" data-reveal>
|
||||||
<h2><span class="hl" style="--c: var(--pink)">From the blog</span></h2>
|
<h2><span class="hl" style="--c: var(--cta-pink)">From the blog</span></h2>
|
||||||
<a class="more" href="/blog">All posts →</a>
|
<a class="more" href="/blog">All posts →</a>
|
||||||
</div>
|
</div>
|
||||||
<ol class="posts">
|
<ol class="posts" data-reveal data-reveal-stagger>
|
||||||
{
|
{
|
||||||
posts.map((post) => (
|
posts.map((post) => (
|
||||||
<li>
|
<li>
|
||||||
@@ -124,164 +224,394 @@ const season = ['Winter', 'Spring', 'Summer', 'Fall'][Math.floor(((now.getMonth(
|
|||||||
</Base>
|
</Base>
|
||||||
|
|
||||||
<style>
|
<style>
|
||||||
/* ---------- cover ---------- */
|
/* ============ cover (mobile first) ============ */
|
||||||
.cover {
|
.cover {
|
||||||
position: relative;
|
position: relative;
|
||||||
display: grid;
|
|
||||||
grid-template-columns: minmax(0, 1fr) minmax(0, 0.9fr);
|
|
||||||
grid-template-areas:
|
|
||||||
'mast mast'
|
|
||||||
'title title'
|
|
||||||
'deck stats';
|
|
||||||
gap: var(--space-5) var(--space-7);
|
|
||||||
margin-top: var(--space-6);
|
|
||||||
padding: var(--space-5) var(--space-6) 5.5rem;
|
|
||||||
border: 3px solid var(--ink);
|
|
||||||
background:
|
|
||||||
radial-gradient(circle, color-mix(in oklab, var(--red) 22%, transparent) 1.3px, transparent 1.7px) 0 0 / 11px 11px,
|
|
||||||
var(--paper-2);
|
|
||||||
box-shadow: 10px 10px 0 var(--ink);
|
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
|
padding-block: var(--space-4) var(--space-7);
|
||||||
|
background:
|
||||||
|
radial-gradient(circle, color-mix(in oklab, var(--cta-red) 20%, transparent) 1.2px, transparent 1.6px) 0 0 / 10px 10px,
|
||||||
|
var(--paper);
|
||||||
|
border-bottom: 3px solid var(--ink);
|
||||||
|
}
|
||||||
|
.cover-in {
|
||||||
|
position: relative;
|
||||||
|
display: grid;
|
||||||
|
grid-template-columns: minmax(0, 1fr);
|
||||||
|
gap: var(--space-5);
|
||||||
}
|
}
|
||||||
.masthead {
|
.masthead {
|
||||||
grid-area: mast;
|
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-wrap: wrap;
|
align-items: flex-end;
|
||||||
gap: var(--space-2) var(--space-5);
|
justify-content: space-between;
|
||||||
align-items: center;
|
gap: var(--space-3);
|
||||||
padding-bottom: var(--space-3);
|
padding-bottom: var(--space-2);
|
||||||
border-bottom: 3px solid var(--ink);
|
border-bottom: 4px solid var(--ink);
|
||||||
font-family: var(--ff-grotesk);
|
animation: drop 0.7s var(--ease) both;
|
||||||
font-weight: 700;
|
|
||||||
font-size: 0.85rem;
|
|
||||||
text-transform: uppercase;
|
|
||||||
letter-spacing: 0.06em;
|
|
||||||
}
|
}
|
||||||
.price {
|
.logo {
|
||||||
margin-inline-start: auto;
|
|
||||||
padding: 0.1em 0.6em;
|
|
||||||
background: var(--red);
|
|
||||||
color: #fff;
|
|
||||||
}
|
|
||||||
.title {
|
|
||||||
grid-area: title;
|
|
||||||
display: grid;
|
|
||||||
font-family: var(--ff-mag);
|
font-family: var(--ff-mag);
|
||||||
font-size: clamp(3.5rem, 13vw, 11.5rem);
|
font-size: clamp(2.8rem, 14vw, 9rem);
|
||||||
line-height: 0.86;
|
line-height: 0.82;
|
||||||
letter-spacing: -0.04em;
|
min-width: 0;
|
||||||
padding-right: 3.5rem;
|
white-space: nowrap;
|
||||||
}
|
letter-spacing: -0.05em;
|
||||||
.l1 {
|
color: var(--cta-red);
|
||||||
color: var(--red);
|
-webkit-text-stroke: 2px var(--ink);
|
||||||
-webkit-text-stroke: 3px var(--ink);
|
|
||||||
paint-order: stroke fill;
|
paint-order: stroke fill;
|
||||||
text-shadow: 6px 6px 0 var(--ink);
|
text-shadow: 4px 4px 0 var(--ink);
|
||||||
}
|
}
|
||||||
.l2 {
|
.logo span {
|
||||||
|
font-size: 0.3em;
|
||||||
color: var(--ink);
|
color: var(--ink);
|
||||||
margin-left: 0.35em;
|
-webkit-text-stroke: 0;
|
||||||
text-shadow: 6px 6px 0 var(--lime);
|
text-shadow: none;
|
||||||
|
letter-spacing: 0;
|
||||||
}
|
}
|
||||||
.kana {
|
.issue {
|
||||||
position: absolute;
|
flex: none;
|
||||||
top: 4.5rem;
|
|
||||||
right: var(--space-5);
|
|
||||||
writing-mode: vertical-rl;
|
|
||||||
font-family: var(--ff-mag);
|
|
||||||
font-size: clamp(1.1rem, 2.4vw, 1.9rem);
|
|
||||||
color: var(--cobalt);
|
|
||||||
letter-spacing: 0.08em;
|
|
||||||
}
|
|
||||||
.cover :global(.burst) {
|
|
||||||
position: absolute;
|
|
||||||
top: clamp(5rem, 8vw, 7rem);
|
|
||||||
right: clamp(4rem, 14vw, 13rem);
|
|
||||||
}
|
|
||||||
.deck {
|
|
||||||
grid-area: deck;
|
|
||||||
display: grid;
|
display: grid;
|
||||||
gap: var(--space-4);
|
justify-items: end;
|
||||||
align-content: start;
|
gap: 2px;
|
||||||
}
|
|
||||||
.role {
|
|
||||||
font-family: var(--ff-grotesk);
|
font-family: var(--ff-grotesk);
|
||||||
font-weight: 800;
|
font-weight: 800;
|
||||||
font-stretch: 105%;
|
font-size: 0.72rem;
|
||||||
font-size: var(--step-2);
|
text-transform: uppercase;
|
||||||
line-height: 1.05;
|
letter-spacing: 0.05em;
|
||||||
letter-spacing: -0.03em;
|
text-align: right;
|
||||||
|
}
|
||||||
|
.price {
|
||||||
|
padding: 0.05em 0.5em;
|
||||||
|
background: var(--ink);
|
||||||
|
color: var(--cta-yellow);
|
||||||
|
}
|
||||||
|
|
||||||
|
.hero {
|
||||||
|
position: relative;
|
||||||
|
}
|
||||||
|
.hero :global(.hero-photo) {
|
||||||
|
animation: rise 0.9s 0.1s var(--ease) both;
|
||||||
|
}
|
||||||
|
.name {
|
||||||
|
position: relative;
|
||||||
|
z-index: 2;
|
||||||
|
display: grid;
|
||||||
|
margin-top: -3.2rem;
|
||||||
|
padding-inline: 0.2rem;
|
||||||
|
font-family: var(--ff-mag);
|
||||||
|
font-weight: 400;
|
||||||
|
font-size: clamp(3.1rem, 15.5vw, 8.5rem);
|
||||||
|
line-height: 0.86;
|
||||||
|
letter-spacing: -0.045em;
|
||||||
|
text-transform: none;
|
||||||
|
animation: rise 0.8s 0.25s var(--ease) both;
|
||||||
|
}
|
||||||
|
.first {
|
||||||
|
color: #fffdf7;
|
||||||
|
-webkit-text-stroke: 2.5px var(--ink);
|
||||||
|
paint-order: stroke fill;
|
||||||
|
text-shadow: 5px 5px 0 var(--ink);
|
||||||
|
}
|
||||||
|
.last {
|
||||||
|
color: var(--ink);
|
||||||
|
text-shadow: 5px 5px 0 var(--cta-yellow);
|
||||||
|
}
|
||||||
|
.role-tag {
|
||||||
|
position: absolute;
|
||||||
|
z-index: 3;
|
||||||
|
top: 0.9rem;
|
||||||
|
left: -0.4rem;
|
||||||
|
padding: 0.3rem 0.7rem;
|
||||||
|
background: var(--cta-blue);
|
||||||
|
color: #fff;
|
||||||
|
border: 2px solid var(--ink);
|
||||||
|
font-family: var(--ff-grotesk);
|
||||||
|
font-weight: 800;
|
||||||
|
font-size: 0.9rem;
|
||||||
|
text-transform: uppercase;
|
||||||
|
letter-spacing: 0.04em;
|
||||||
|
rotate: -4deg;
|
||||||
|
box-shadow: 3px 3px 0 var(--ink);
|
||||||
|
}
|
||||||
|
.badge {
|
||||||
|
position: absolute;
|
||||||
|
z-index: 3;
|
||||||
|
top: -0.8rem;
|
||||||
|
right: -0.4rem;
|
||||||
|
display: grid;
|
||||||
|
place-items: center;
|
||||||
|
width: 6.6rem;
|
||||||
|
height: 6.6rem;
|
||||||
|
border-radius: 50%;
|
||||||
|
background: var(--ink);
|
||||||
|
color: var(--paper);
|
||||||
|
}
|
||||||
|
.badge :global(.badge-ring) {
|
||||||
|
position: absolute;
|
||||||
|
inset: 0;
|
||||||
|
width: 100%;
|
||||||
|
height: 100%;
|
||||||
|
margin: 0;
|
||||||
|
font-family: var(--ff-mono);
|
||||||
|
font-weight: 500;
|
||||||
|
color: var(--paper);
|
||||||
|
}
|
||||||
|
.badge :global(.badge-ring span) {
|
||||||
|
font-size: 0.68rem;
|
||||||
|
inset: 0.25rem;
|
||||||
|
}
|
||||||
|
.sticker {
|
||||||
|
position: absolute;
|
||||||
|
z-index: 4;
|
||||||
|
}
|
||||||
|
.sticker-gba {
|
||||||
|
right: -0.5rem;
|
||||||
|
bottom: 5.5rem;
|
||||||
|
width: 150px;
|
||||||
|
height: 110px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.deck {
|
||||||
|
display: grid;
|
||||||
|
gap: var(--space-4);
|
||||||
}
|
}
|
||||||
.lede {
|
.lede {
|
||||||
max-width: 46ch;
|
font-size: 1.12rem;
|
||||||
font-size: var(--step-0);
|
line-height: 1.55;
|
||||||
color: var(--ink-2);
|
|
||||||
}
|
}
|
||||||
.stats {
|
.lede mark {
|
||||||
grid-area: stats;
|
background: linear-gradient(transparent 55%, var(--cta-yellow) 55%);
|
||||||
|
color: inherit;
|
||||||
|
}
|
||||||
|
.cta {
|
||||||
|
display: grid;
|
||||||
|
grid-template-columns: 1fr 1fr;
|
||||||
|
gap: var(--space-2);
|
||||||
|
}
|
||||||
|
.cta .btn {
|
||||||
|
justify-content: center;
|
||||||
|
min-height: 48px;
|
||||||
|
font-size: 0.95rem;
|
||||||
|
}
|
||||||
|
.cta .btn:first-child {
|
||||||
|
grid-column: 1 / -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
.coverlines {
|
||||||
display: grid;
|
display: grid;
|
||||||
gap: var(--space-3);
|
gap: var(--space-3);
|
||||||
align-content: start;
|
|
||||||
list-style: none;
|
list-style: none;
|
||||||
padding: 0;
|
padding: 0;
|
||||||
}
|
}
|
||||||
.stats li {
|
.cl {
|
||||||
padding: 0.7rem 0.9rem;
|
position: relative;
|
||||||
background: var(--c);
|
padding: 0.75rem 0.9rem;
|
||||||
border: 2px solid var(--ink);
|
border: 2px solid var(--ink);
|
||||||
font-size: 0.95rem;
|
font-family: var(--ff-grotesk);
|
||||||
line-height: 1.3;
|
font-weight: 600;
|
||||||
|
line-height: 1.25;
|
||||||
|
box-shadow: 4px 4px 0 var(--ink);
|
||||||
}
|
}
|
||||||
.stats li:nth-child(1) {
|
.cl a {
|
||||||
rotate: -1.5deg;
|
color: inherit;
|
||||||
|
text-decoration: none;
|
||||||
|
display: block;
|
||||||
}
|
}
|
||||||
.stats li:nth-child(2) {
|
.cl .big {
|
||||||
rotate: 1deg;
|
|
||||||
margin-left: 1.5rem;
|
|
||||||
}
|
|
||||||
.stats li:nth-child(3) {
|
|
||||||
rotate: -0.5deg;
|
|
||||||
}
|
|
||||||
.stats b {
|
|
||||||
display: block;
|
display: block;
|
||||||
font-family: var(--ff-mag);
|
font-family: var(--ff-mag);
|
||||||
font-weight: 400;
|
font-weight: 400;
|
||||||
font-size: var(--step-2);
|
font-size: 1.7rem;
|
||||||
line-height: 1;
|
line-height: 1.05;
|
||||||
}
|
}
|
||||||
.corner {
|
.cl .pg {
|
||||||
position: absolute;
|
position: absolute;
|
||||||
right: 0;
|
right: 0.5rem;
|
||||||
bottom: 0;
|
top: 0.4rem;
|
||||||
border-top: 2px solid var(--ink);
|
font-family: var(--ff-mono);
|
||||||
border-left: 2px solid var(--ink);
|
font-size: 0.7rem;
|
||||||
}
|
}
|
||||||
|
.cl-1 {
|
||||||
@media (max-width: 52rem) {
|
background: var(--cta-pink);
|
||||||
.cover {
|
rotate: -1.2deg;
|
||||||
grid-template-columns: minmax(0, 1fr);
|
|
||||||
grid-template-areas: 'mast' 'title' 'deck' 'stats';
|
|
||||||
padding-inline: var(--space-4);
|
|
||||||
padding-bottom: 6rem;
|
|
||||||
box-shadow: 6px 6px 0 var(--ink);
|
|
||||||
}
|
}
|
||||||
.kana {
|
.cl-2 {
|
||||||
display: none;
|
background: #fffdf7;
|
||||||
|
rotate: 0.8deg;
|
||||||
}
|
}
|
||||||
.title {
|
.cl-3 {
|
||||||
padding-right: 0;
|
background: var(--cta-green);
|
||||||
|
color: #fff;
|
||||||
|
rotate: -0.6deg;
|
||||||
}
|
}
|
||||||
.cover :global(.burst) {
|
.cover :global(.burst) {
|
||||||
top: 4.5rem;
|
position: absolute;
|
||||||
right: var(--space-2);
|
right: 0;
|
||||||
width: 5.75rem;
|
bottom: -0.5rem;
|
||||||
|
z-index: 5;
|
||||||
}
|
}
|
||||||
.stats li:nth-child(2) {
|
.barcode-wrap {
|
||||||
margin-left: 0;
|
justify-self: start;
|
||||||
|
border: 2px solid var(--ink);
|
||||||
|
}
|
||||||
|
|
||||||
|
@keyframes rise {
|
||||||
|
from {
|
||||||
|
opacity: 0;
|
||||||
|
transform: translateY(28px);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@keyframes drop {
|
||||||
|
from {
|
||||||
|
opacity: 0;
|
||||||
|
transform: translateY(-16px);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ---------- sections ---------- */
|
/* ============ cover (desktop) ============ */
|
||||||
|
@media (min-width: 60rem) {
|
||||||
|
.cover {
|
||||||
|
padding-block: var(--space-6) var(--space-8);
|
||||||
|
}
|
||||||
|
.cover-in {
|
||||||
|
grid-template-columns: minmax(0, 1.15fr) minmax(0, 0.85fr);
|
||||||
|
grid-template-areas:
|
||||||
|
'mast mast'
|
||||||
|
'hero deck'
|
||||||
|
'hero lines'
|
||||||
|
'hero code';
|
||||||
|
column-gap: var(--space-7);
|
||||||
|
align-items: start;
|
||||||
|
}
|
||||||
|
.masthead {
|
||||||
|
grid-area: mast;
|
||||||
|
}
|
||||||
|
.hero {
|
||||||
|
grid-area: hero;
|
||||||
|
}
|
||||||
|
.deck {
|
||||||
|
grid-area: deck;
|
||||||
|
}
|
||||||
|
.coverlines {
|
||||||
|
grid-area: lines;
|
||||||
|
}
|
||||||
|
.barcode-wrap {
|
||||||
|
grid-area: code;
|
||||||
|
}
|
||||||
|
.issue {
|
||||||
|
font-size: 0.95rem;
|
||||||
|
}
|
||||||
|
.name {
|
||||||
|
margin-top: -5rem;
|
||||||
|
}
|
||||||
|
.lede {
|
||||||
|
font-size: 1.25rem;
|
||||||
|
}
|
||||||
|
.badge {
|
||||||
|
width: 8.5rem;
|
||||||
|
height: 8.5rem;
|
||||||
|
right: -1.5rem;
|
||||||
|
}
|
||||||
|
.badge :global(.badge-ring span) {
|
||||||
|
font-size: 0.85rem;
|
||||||
|
}
|
||||||
|
.sticker-gba {
|
||||||
|
right: -3rem;
|
||||||
|
bottom: 8rem;
|
||||||
|
}
|
||||||
|
.cover :global(.burst) {
|
||||||
|
right: 2rem;
|
||||||
|
bottom: -1rem;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* ============ ticker ============ */
|
||||||
|
.ticker {
|
||||||
|
background: var(--ink);
|
||||||
|
color: var(--paper);
|
||||||
|
padding-block: 0.6rem;
|
||||||
|
border-bottom: 3px solid var(--ink);
|
||||||
|
}
|
||||||
|
.ticker :global(.ticker-text) {
|
||||||
|
font-family: var(--ff-mag);
|
||||||
|
font-weight: 400;
|
||||||
|
font-size: clamp(1.6rem, 6vw, 3.4rem);
|
||||||
|
line-height: 1.25;
|
||||||
|
letter-spacing: -0.01em;
|
||||||
|
text-transform: uppercase;
|
||||||
|
}
|
||||||
|
.ticker :global(.parallax:nth-child(2) .ticker-text) {
|
||||||
|
color: var(--cta-yellow);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* ============ stats + collage ============ */
|
||||||
|
.stats-wrap {
|
||||||
|
display: grid;
|
||||||
|
gap: var(--space-7);
|
||||||
|
}
|
||||||
|
.collage {
|
||||||
|
position: relative;
|
||||||
|
height: 22rem;
|
||||||
|
}
|
||||||
|
.collage :global(.c-sign) {
|
||||||
|
position: absolute;
|
||||||
|
left: 0;
|
||||||
|
top: 0.5rem;
|
||||||
|
width: 46%;
|
||||||
|
}
|
||||||
|
.collage :global(.c-marina) {
|
||||||
|
position: absolute;
|
||||||
|
right: 2%;
|
||||||
|
top: 0;
|
||||||
|
width: 40%;
|
||||||
|
}
|
||||||
|
.collage :global(.c-cassette) {
|
||||||
|
position: absolute;
|
||||||
|
left: 24%;
|
||||||
|
bottom: 0;
|
||||||
|
width: 50%;
|
||||||
|
z-index: 2;
|
||||||
|
}
|
||||||
|
.sticker-floppy {
|
||||||
|
right: 0;
|
||||||
|
bottom: 0.5rem;
|
||||||
|
width: 130px;
|
||||||
|
height: 90px;
|
||||||
|
}
|
||||||
|
.stats {
|
||||||
|
display: grid;
|
||||||
|
gap: var(--space-4);
|
||||||
|
}
|
||||||
|
.stat {
|
||||||
|
display: grid;
|
||||||
|
gap: 0.2rem;
|
||||||
|
padding: 1rem 1.1rem;
|
||||||
|
background: var(--c);
|
||||||
|
border: 2px solid var(--ink);
|
||||||
|
box-shadow: 5px 5px 0 var(--ink);
|
||||||
|
}
|
||||||
|
.stat b {
|
||||||
|
font-family: var(--ff-mag);
|
||||||
|
font-weight: 400;
|
||||||
|
font-size: clamp(2.3rem, 10vw, 3.4rem);
|
||||||
|
line-height: 1;
|
||||||
|
letter-spacing: -0.03em;
|
||||||
|
}
|
||||||
|
.stat span {
|
||||||
|
font-family: var(--ff-grotesk);
|
||||||
|
font-weight: 600;
|
||||||
|
}
|
||||||
|
@media (min-width: 52rem) {
|
||||||
|
.stats-wrap {
|
||||||
|
grid-template-columns: 1fr 1fr;
|
||||||
|
align-items: center;
|
||||||
|
}
|
||||||
|
.collage {
|
||||||
|
height: 30rem;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* ============ sections ============ */
|
||||||
.head {
|
.head {
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-wrap: wrap;
|
flex-wrap: wrap;
|
||||||
@@ -291,64 +621,118 @@ const season = ['Winter', 'Spring', 'Summer', 'Fall'][Math.floor(((now.getMonth(
|
|||||||
margin-bottom: var(--space-6);
|
margin-bottom: var(--space-6);
|
||||||
}
|
}
|
||||||
.head h2 {
|
.head h2 {
|
||||||
font-size: var(--step-4);
|
font-size: clamp(2.3rem, 10vw, 4.75rem);
|
||||||
}
|
}
|
||||||
.hl {
|
.hl {
|
||||||
padding: 0 0.15em;
|
padding: 0 0.12em;
|
||||||
background: linear-gradient(transparent 55%, var(--c) 55% 92%, transparent 92%);
|
background: linear-gradient(transparent 55%, var(--c) 55% 92%, transparent 92%);
|
||||||
}
|
}
|
||||||
.more {
|
.more {
|
||||||
font-family: var(--ff-grotesk);
|
font-family: var(--ff-grotesk);
|
||||||
font-weight: 700;
|
font-weight: 700;
|
||||||
}
|
min-height: 44px;
|
||||||
.grid {
|
display: inline-flex;
|
||||||
display: grid;
|
align-items: center;
|
||||||
grid-template-columns: repeat(auto-fill, minmax(min(100%, 20rem), 1fr));
|
|
||||||
gap: var(--space-5);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* horizontal swipe rail on mobile, grid on desktop */
|
||||||
|
.rail {
|
||||||
|
display: grid;
|
||||||
|
grid-auto-flow: column;
|
||||||
|
grid-auto-columns: min(82vw, 21rem);
|
||||||
|
gap: var(--space-4);
|
||||||
|
overflow-x: auto;
|
||||||
|
scroll-snap-type: x mandatory;
|
||||||
|
padding: 0.5rem var(--gutter) 1rem;
|
||||||
|
scroll-padding-inline: var(--gutter);
|
||||||
|
scrollbar-width: none;
|
||||||
|
overscroll-behavior-x: contain;
|
||||||
|
}
|
||||||
|
.rail::-webkit-scrollbar {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
.rail > :global(*) {
|
||||||
|
scroll-snap-align: start;
|
||||||
|
}
|
||||||
|
.swipe {
|
||||||
|
font-family: var(--ff-mono);
|
||||||
|
font-size: 0.8rem;
|
||||||
|
color: var(--fg-muted);
|
||||||
|
}
|
||||||
|
@media (min-width: 60rem) {
|
||||||
|
.rail {
|
||||||
|
grid-auto-flow: row;
|
||||||
|
grid-template-columns: repeat(3, 1fr);
|
||||||
|
grid-auto-columns: auto;
|
||||||
|
overflow: visible;
|
||||||
|
width: min(100% - 2 * var(--gutter), var(--max-w));
|
||||||
|
margin-inline: auto;
|
||||||
|
padding: 0;
|
||||||
|
gap: var(--space-5);
|
||||||
|
}
|
||||||
|
.swipe {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.what {
|
||||||
|
display: grid;
|
||||||
|
gap: var(--space-7);
|
||||||
|
}
|
||||||
.lines {
|
.lines {
|
||||||
display: grid;
|
display: grid;
|
||||||
gap: var(--space-3);
|
gap: var(--space-2);
|
||||||
list-style: none;
|
list-style: none;
|
||||||
padding: 0;
|
padding: 0;
|
||||||
}
|
}
|
||||||
.lines a {
|
.lines a {
|
||||||
display: grid;
|
display: grid;
|
||||||
grid-template-columns: auto auto 1fr auto;
|
grid-template-columns: auto 1fr auto;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
gap: var(--space-4);
|
gap: var(--space-3);
|
||||||
padding: var(--space-2) 0;
|
min-height: 3.25rem;
|
||||||
text-decoration: none;
|
text-decoration: none;
|
||||||
color: var(--ink);
|
color: var(--ink);
|
||||||
}
|
}
|
||||||
.lname {
|
.lname {
|
||||||
font-family: var(--ff-grotesk);
|
font-family: var(--ff-grotesk);
|
||||||
font-weight: 800;
|
font-weight: 800;
|
||||||
font-size: var(--step-2);
|
font-size: clamp(1.35rem, 5.5vw, 2rem);
|
||||||
letter-spacing: -0.03em;
|
letter-spacing: -0.03em;
|
||||||
}
|
}
|
||||||
.track {
|
.track {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
.count {
|
||||||
|
display: grid;
|
||||||
|
place-items: center;
|
||||||
|
min-width: 2rem;
|
||||||
|
height: 2rem;
|
||||||
|
border: 2px solid var(--ink);
|
||||||
|
border-radius: 999px;
|
||||||
|
font-family: var(--ff-mono);
|
||||||
|
font-size: 0.85rem;
|
||||||
|
}
|
||||||
|
.what-photos {
|
||||||
|
display: grid;
|
||||||
|
grid-template-columns: 1fr 1fr;
|
||||||
|
gap: var(--space-4);
|
||||||
|
align-items: start;
|
||||||
|
}
|
||||||
|
@media (min-width: 52rem) {
|
||||||
|
.what {
|
||||||
|
grid-template-columns: 1.4fr 1fr;
|
||||||
|
align-items: center;
|
||||||
|
}
|
||||||
|
.lines a {
|
||||||
|
grid-template-columns: auto auto 1fr auto;
|
||||||
|
}
|
||||||
|
.track {
|
||||||
|
display: block;
|
||||||
height: 10px;
|
height: 10px;
|
||||||
border-radius: 5px;
|
border-radius: 5px;
|
||||||
background: var(--c);
|
background: var(--c);
|
||||||
border: 2px solid var(--ink);
|
border: 2px solid var(--ink);
|
||||||
transition: transform 0.25s var(--ease);
|
|
||||||
transform-origin: left;
|
|
||||||
}
|
|
||||||
.lines a:hover .track {
|
|
||||||
transform: scaleX(1.03);
|
|
||||||
}
|
|
||||||
.count {
|
|
||||||
font-family: var(--ff-mono);
|
|
||||||
font-size: var(--step--1);
|
|
||||||
}
|
|
||||||
@media (max-width: 40rem) {
|
|
||||||
.lines a {
|
|
||||||
grid-template-columns: auto 1fr auto;
|
|
||||||
}
|
|
||||||
.track {
|
|
||||||
display: none;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -359,36 +743,35 @@ const season = ['Winter', 'Spring', 'Summer', 'Fall'][Math.floor(((now.getMonth(
|
|||||||
}
|
}
|
||||||
.posts a {
|
.posts a {
|
||||||
display: grid;
|
display: grid;
|
||||||
grid-template-columns: 9rem 1fr;
|
gap: 0.3rem;
|
||||||
gap: 0.2rem var(--space-5);
|
|
||||||
padding-block: var(--space-4);
|
padding-block: var(--space-4);
|
||||||
border-bottom: 2px solid var(--ink);
|
border-bottom: 2px solid var(--ink);
|
||||||
text-decoration: none;
|
text-decoration: none;
|
||||||
color: var(--ink);
|
color: var(--ink);
|
||||||
}
|
}
|
||||||
|
.posts a:active,
|
||||||
.posts a:hover {
|
.posts a:hover {
|
||||||
background: var(--lime);
|
background: var(--cta-yellow);
|
||||||
}
|
}
|
||||||
time {
|
time {
|
||||||
font-family: var(--ff-mono);
|
font-family: var(--ff-mono);
|
||||||
font-size: var(--step--1);
|
font-size: var(--step--1);
|
||||||
padding-top: 0.3em;
|
|
||||||
}
|
}
|
||||||
.ptitle {
|
.ptitle {
|
||||||
font-family: var(--ff-mag);
|
font-family: var(--ff-mag);
|
||||||
font-size: var(--step-2);
|
font-size: clamp(1.5rem, 6vw, 2rem);
|
||||||
line-height: 1.1;
|
line-height: 1.1;
|
||||||
}
|
}
|
||||||
.psum {
|
.psum {
|
||||||
grid-column: 2;
|
|
||||||
color: var(--ink-2);
|
color: var(--ink-2);
|
||||||
}
|
}
|
||||||
@media (max-width: 40rem) {
|
@media (min-width: 52rem) {
|
||||||
.posts a {
|
.posts a {
|
||||||
grid-template-columns: 1fr;
|
grid-template-columns: 9rem 1fr;
|
||||||
|
column-gap: var(--space-5);
|
||||||
}
|
}
|
||||||
.psum {
|
.psum {
|
||||||
grid-column: 1;
|
grid-column: 2;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
@@ -1,33 +1,91 @@
|
|||||||
---
|
---
|
||||||
import { getCollection } from 'astro:content';
|
import { getCollection } from 'astro:content';
|
||||||
|
import { Image } from 'astro:assets';
|
||||||
import Base from '../layouts/Base.astro';
|
import Base from '../layouts/Base.astro';
|
||||||
import ModelViewer from '../components/ModelViewer.astro';
|
import ModelViewer from '../components/ModelViewer.astro';
|
||||||
|
import FaultyTerminal from '../components/bits/FaultyTerminal';
|
||||||
import { media } from '../lib/media';
|
import { media } from '../lib/media';
|
||||||
|
import cloud from '../assets/photos/cloud.jpg';
|
||||||
|
import hibiscus from '../assets/photos/hibiscus.jpg';
|
||||||
|
|
||||||
const models = (await getCollection('models')).sort((a, b) => +b.data.date - +a.data.date);
|
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">
|
<Base title="3D Models" description="3D models by Johan Sandoval, viewable in the browser." theme="vector">
|
||||||
<section class="hero">
|
<section class="hero">
|
||||||
<div class="floor" aria-hidden="true"></div>
|
<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">
|
<div class="wrap intro">
|
||||||
<p class="sys">Blender · glTF · real-time in the browser</p>
|
<p class="sys">Blender · glTF · real-time in the browser</p>
|
||||||
<h1 class="glow">3D Models</h1>
|
<h1 class="glow">3D Models</h1>
|
||||||
<p class="sub">Models I've built in Blender. Drag to rotate, scroll to zoom.</p>
|
<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">
|
||||||
|
<Image src={hibiscus} alt="" widths={[400, 700, 1000]} 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>
|
||||||
</div>
|
</div>
|
||||||
</section>
|
</section>
|
||||||
|
|
||||||
<section class="wrap section">
|
<section class="wrap section">
|
||||||
<div class="grid">
|
<div class="grid" data-reveal data-reveal-stagger>
|
||||||
{
|
{
|
||||||
models.map((m, i) => (
|
models.map((m, i) => (
|
||||||
<figure class="item">
|
<figure class="item">
|
||||||
<ModelViewer
|
<ModelViewer src={media(m.data.file)} poster={m.data.poster && media(m.data.poster)} alt={m.data.title} ratio="1 / 1" />
|
||||||
src={media(m.data.file)}
|
|
||||||
poster={m.data.poster && media(m.data.poster)}
|
|
||||||
alt={m.data.title}
|
|
||||||
ratio="1 / 1"
|
|
||||||
/>
|
|
||||||
<figcaption>
|
<figcaption>
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<h2>{m.data.title}</h2>
|
<h2>{m.data.title}</h2>
|
||||||
@@ -56,37 +114,26 @@ const models = (await getCollection('models')).sort((a, b) => +b.data.date - +a.
|
|||||||
.hero {
|
.hero {
|
||||||
position: relative;
|
position: relative;
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
min-height: 26rem;
|
min-height: clamp(22rem, 92vw, 32rem);
|
||||||
display: grid;
|
display: grid;
|
||||||
align-items: end;
|
align-items: end;
|
||||||
border-bottom: 1px solid var(--line-strong);
|
border-bottom: 1px solid var(--line-strong);
|
||||||
perspective: 420px;
|
background: #000;
|
||||||
}
|
}
|
||||||
.floor {
|
.term {
|
||||||
position: absolute;
|
position: absolute;
|
||||||
left: -50%;
|
inset: 0;
|
||||||
right: -50%;
|
opacity: 0.85;
|
||||||
bottom: -40%;
|
|
||||||
height: 120%;
|
|
||||||
background:
|
|
||||||
linear-gradient(var(--cyan) 1px, transparent 1px) 0 0 / 60px 60px,
|
|
||||||
linear-gradient(90deg, var(--cyan) 1px, transparent 1px) 0 0 / 60px 60px;
|
|
||||||
transform: rotateX(68deg);
|
|
||||||
transform-origin: bottom;
|
|
||||||
mask: linear-gradient(to top, #000 10%, transparent 75%);
|
|
||||||
opacity: 0.55;
|
|
||||||
animation: travel 6s linear infinite;
|
|
||||||
}
|
|
||||||
@keyframes travel {
|
|
||||||
to {
|
|
||||||
background-position:
|
|
||||||
0 60px,
|
|
||||||
0 0;
|
|
||||||
}
|
}
|
||||||
|
.term::after {
|
||||||
|
content: '';
|
||||||
|
position: absolute;
|
||||||
|
inset: 0;
|
||||||
|
background: linear-gradient(to top, #050507 8%, transparent 70%);
|
||||||
}
|
}
|
||||||
.intro {
|
.intro {
|
||||||
position: relative;
|
position: relative;
|
||||||
padding-block: var(--space-8) var(--space-7);
|
padding-block: var(--space-8) var(--space-6);
|
||||||
}
|
}
|
||||||
.sys {
|
.sys {
|
||||||
font-family: var(--ff-crt);
|
font-family: var(--ff-crt);
|
||||||
@@ -94,14 +141,180 @@ const models = (await getCollection('models')).sort((a, b) => +b.data.date - +a.
|
|||||||
color: var(--signal);
|
color: var(--signal);
|
||||||
}
|
}
|
||||||
h1 {
|
h1 {
|
||||||
font-size: clamp(4.5rem, 16vw, 12rem);
|
font-size: clamp(4rem, 19vw, 12rem);
|
||||||
line-height: 0.85;
|
line-height: 0.85;
|
||||||
color: var(--accent);
|
color: var(--accent);
|
||||||
}
|
}
|
||||||
.sub {
|
.sub {
|
||||||
max-width: 44ch;
|
max-width: 44ch;
|
||||||
color: var(--fg-muted);
|
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;
|
||||||
|
}
|
||||||
|
.petal :global(img) {
|
||||||
|
width: 100%;
|
||||||
|
filter: saturate(1.3) contrast(1.1);
|
||||||
|
}
|
||||||
|
.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 {
|
.grid {
|
||||||
display: grid;
|
display: grid;
|
||||||
grid-template-columns: repeat(auto-fill, minmax(min(100%, 22rem), 1fr));
|
grid-template-columns: repeat(auto-fill, minmax(min(100%, 22rem), 1fr));
|
||||||
@@ -125,7 +338,7 @@ const models = (await getCollection('models')).sort((a, b) => +b.data.date - +a.
|
|||||||
align-items: baseline;
|
align-items: baseline;
|
||||||
gap: var(--space-3);
|
gap: var(--space-3);
|
||||||
}
|
}
|
||||||
h2 {
|
.item h2 {
|
||||||
font-size: var(--step-3);
|
font-size: var(--step-3);
|
||||||
color: var(--fg);
|
color: var(--fg);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,6 +3,15 @@ import { getCollection } from 'astro:content';
|
|||||||
import Base from '../layouts/Base.astro';
|
import Base from '../layouts/Base.astro';
|
||||||
import AudioPlayer from '../components/AudioPlayer';
|
import AudioPlayer from '../components/AudioPlayer';
|
||||||
import { media } from '../lib/media';
|
import { media } from '../lib/media';
|
||||||
|
import { getImage } from 'astro:assets';
|
||||||
|
import HalftoneReveal from '../components/bits/HalftoneReveal';
|
||||||
|
import Clipping from '../components/deco/Clipping.astro';
|
||||||
|
import pedalboard from '../assets/photos/pedalboard.jpg';
|
||||||
|
import hollow from '../assets/photos/guitar-hollow.jpg';
|
||||||
|
import synth from '../assets/photos/synth.jpg';
|
||||||
|
import cassette from '../assets/photos/cassette.jpg';
|
||||||
|
|
||||||
|
const board = await getImage({ src: pedalboard, width: 1280, format: 'webp' });
|
||||||
|
|
||||||
const tracks = (await getCollection('music')).sort((a, b) => +b.data.date - +a.data.date);
|
const tracks = (await getCollection('music')).sort((a, b) => +b.data.date - +a.data.date);
|
||||||
const cable = ['var(--red)', 'var(--yellow)', 'var(--cobalt)', 'var(--grass)', 'var(--pink)'];
|
const cable = ['var(--red)', 'var(--yellow)', 'var(--cobalt)', 'var(--grass)', 'var(--pink)'];
|
||||||
@@ -10,6 +19,21 @@ const cable = ['var(--red)', 'var(--yellow)', 'var(--cobalt)', 'var(--grass)', '
|
|||||||
|
|
||||||
<Base title="Music" description="Guitar and original recordings by Johan Sandoval." theme="radio">
|
<Base title="Music" description="Guitar and original recordings by Johan Sandoval." theme="radio">
|
||||||
<section class="hero">
|
<section class="hero">
|
||||||
|
<div class="photo" aria-hidden="true">
|
||||||
|
<HalftoneReveal
|
||||||
|
client:only="react"
|
||||||
|
src={board.src}
|
||||||
|
mode="duotone"
|
||||||
|
inkColor="#141412"
|
||||||
|
paperColor="#f7f1e1"
|
||||||
|
dotDensity={90}
|
||||||
|
dotSize={1.05}
|
||||||
|
revealRadius={0.32}
|
||||||
|
idleReveal={0.18}
|
||||||
|
borderRadius="0"
|
||||||
|
className="ht"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
<svg class="cables" viewBox="0 0 1200 260" preserveAspectRatio="none" aria-hidden="true">
|
<svg class="cables" viewBox="0 0 1200 260" preserveAspectRatio="none" aria-hidden="true">
|
||||||
<path d="M-20 40 C 200 260, 360 -40, 560 140 S 900 40, 1220 200" stroke={cable[0]} />
|
<path d="M-20 40 C 200 260, 360 -40, 560 140 S 900 40, 1220 200" stroke={cable[0]} />
|
||||||
<path d="M-20 200 C 180 20, 420 260, 640 80 S 980 240, 1220 60" stroke={cable[1]} />
|
<path d="M-20 200 C 180 20, 420 260, 640 80 S 980 240, 1220 60" stroke={cable[1]} />
|
||||||
@@ -17,7 +41,7 @@ const cable = ['var(--red)', 'var(--yellow)', 'var(--cobalt)', 'var(--grass)', '
|
|||||||
<path d="M-20 250 C 300 160, 520 -10, 760 40 S 1050 230, 1220 250" stroke={cable[3]} />
|
<path d="M-20 250 C 300 160, 520 -10, 760 40 S 1050 230, 1220 250" stroke={cable[3]} />
|
||||||
</svg>
|
</svg>
|
||||||
<div class="wrap intro">
|
<div class="wrap intro">
|
||||||
<p class="tune">guitar · recordings · experiments</p>
|
<p class="tune">Guitar · recordings · experiments</p>
|
||||||
<h1>Music</h1>
|
<h1>Music</h1>
|
||||||
<div class="lcd" aria-hidden="true">
|
<div class="lcd" aria-hidden="true">
|
||||||
<span class="rec"></span>
|
<span class="rec"></span>
|
||||||
@@ -26,8 +50,14 @@ const cable = ['var(--red)', 'var(--yellow)', 'var(--cobalt)', 'var(--grass)', '
|
|||||||
</div>
|
</div>
|
||||||
</section>
|
</section>
|
||||||
|
|
||||||
|
<section class="wrap collage" aria-hidden="true">
|
||||||
|
<Clipping src={hollow} ratio="4 / 5" rotate={-5} tape="top" treatment="riso" ink="var(--cta-pink)" widths={[300, 500]} sizes="34vw" class="c1" />
|
||||||
|
<Clipping src={synth} ratio="1 / 1" rotate={4} tape="corners" widths={[300, 500]} sizes="34vw" class="c2" />
|
||||||
|
<Clipping src={cassette} ratio="16 / 10" rotate={-2} border={false} widths={[300, 500]} sizes="34vw" class="c3" />
|
||||||
|
</section>
|
||||||
|
|
||||||
<section class="wrap section">
|
<section class="wrap section">
|
||||||
<ol class="tracks">
|
<ol class="tracks" data-reveal data-reveal-stagger>
|
||||||
{
|
{
|
||||||
tracks.map((t, i) => (
|
tracks.map((t, i) => (
|
||||||
<li class="track" style={`--c:${cable[i % cable.length]}`}>
|
<li class="track" style={`--c:${cable[i % cable.length]}`}>
|
||||||
@@ -61,9 +91,24 @@ const cable = ['var(--red)', 'var(--yellow)', 'var(--cobalt)', 'var(--grass)', '
|
|||||||
.hero {
|
.hero {
|
||||||
position: relative;
|
position: relative;
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
|
min-height: clamp(24rem, 100vw, 36rem);
|
||||||
|
display: grid;
|
||||||
|
align-items: end;
|
||||||
|
background: #f7f1e1;
|
||||||
border-bottom: 3px solid var(--fg);
|
border-bottom: 3px solid var(--fg);
|
||||||
}
|
}
|
||||||
|
.photo {
|
||||||
|
position: absolute;
|
||||||
|
inset: 0;
|
||||||
|
}
|
||||||
|
.photo :global(.ht) {
|
||||||
|
touch-action: pan-y;
|
||||||
|
}
|
||||||
|
.photo :global(canvas) {
|
||||||
|
object-fit: cover;
|
||||||
|
}
|
||||||
.cables {
|
.cables {
|
||||||
|
pointer-events: none;
|
||||||
position: absolute;
|
position: absolute;
|
||||||
inset: 0;
|
inset: 0;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
@@ -77,11 +122,15 @@ const cable = ['var(--red)', 'var(--yellow)', 'var(--cobalt)', 'var(--grass)', '
|
|||||||
}
|
}
|
||||||
.intro {
|
.intro {
|
||||||
position: relative;
|
position: relative;
|
||||||
|
pointer-events: none;
|
||||||
display: grid;
|
display: grid;
|
||||||
justify-items: start;
|
justify-items: start;
|
||||||
gap: var(--space-3);
|
gap: var(--space-3);
|
||||||
padding-block: var(--space-8) var(--space-7);
|
padding-block: var(--space-8) var(--space-7);
|
||||||
}
|
}
|
||||||
|
.intro > * {
|
||||||
|
pointer-events: auto;
|
||||||
|
}
|
||||||
.tune {
|
.tune {
|
||||||
padding: 0.2em 0.7em;
|
padding: 0.2em 0.7em;
|
||||||
background: var(--bg);
|
background: var(--bg);
|
||||||
@@ -137,12 +186,44 @@ const cable = ['var(--red)', 'var(--yellow)', 'var(--cobalt)', 'var(--grass)', '
|
|||||||
padding-left: 100%;
|
padding-left: 100%;
|
||||||
animation: marquee 14s linear infinite;
|
animation: marquee 14s linear infinite;
|
||||||
}
|
}
|
||||||
|
@media (prefers-reduced-motion: reduce) {
|
||||||
|
.scroll span {
|
||||||
|
padding-left: 0;
|
||||||
|
animation: none;
|
||||||
|
}
|
||||||
|
}
|
||||||
@keyframes marquee {
|
@keyframes marquee {
|
||||||
to {
|
to {
|
||||||
transform: translateX(-100%);
|
transform: translateX(-100%);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.collage {
|
||||||
|
position: relative;
|
||||||
|
display: grid;
|
||||||
|
grid-template-columns: 1fr 1fr;
|
||||||
|
gap: var(--space-3);
|
||||||
|
margin-top: calc(-1 * var(--space-6));
|
||||||
|
z-index: 2;
|
||||||
|
}
|
||||||
|
.collage :global(.c3) {
|
||||||
|
grid-column: 1 / -1;
|
||||||
|
width: 70%;
|
||||||
|
justify-self: center;
|
||||||
|
margin-top: calc(-1 * var(--space-6));
|
||||||
|
}
|
||||||
|
@media (min-width: 52rem) {
|
||||||
|
.collage {
|
||||||
|
grid-template-columns: 1fr 1fr 1.3fr;
|
||||||
|
align-items: center;
|
||||||
|
width: min(100% - 2 * var(--gutter), 52rem);
|
||||||
|
}
|
||||||
|
.collage :global(.c3) {
|
||||||
|
grid-column: auto;
|
||||||
|
width: 100%;
|
||||||
|
margin-top: 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
.tracks {
|
.tracks {
|
||||||
display: grid;
|
display: grid;
|
||||||
gap: var(--space-6);
|
gap: var(--space-6);
|
||||||
@@ -223,6 +304,11 @@ const cable = ['var(--red)', 'var(--yellow)', 'var(--cobalt)', 'var(--grass)', '
|
|||||||
.deck :global(.time) {
|
.deck :global(.time) {
|
||||||
font-family: var(--ff-dot);
|
font-family: var(--ff-dot);
|
||||||
font-weight: 700;
|
font-weight: 700;
|
||||||
|
font-size: 0.85rem;
|
||||||
|
line-height: 1.2;
|
||||||
|
}
|
||||||
|
.deck :global(.time) {
|
||||||
|
white-space: nowrap;
|
||||||
}
|
}
|
||||||
.deck :global(.err) {
|
.deck :global(.err) {
|
||||||
color: var(--pink);
|
color: var(--pink);
|
||||||
|
|||||||
@@ -1,60 +1,75 @@
|
|||||||
---
|
---
|
||||||
import { getCollection } from 'astro:content';
|
import { getCollection } from 'astro:content';
|
||||||
|
import { Image } from 'astro:assets';
|
||||||
import Base from '../../layouts/Base.astro';
|
import Base from '../../layouts/Base.astro';
|
||||||
import ProjectCard from '../../components/ProjectCard.astro';
|
import ProjectCard from '../../components/ProjectCard.astro';
|
||||||
import LineBadge from '../../components/LineBadge.astro';
|
import LineBadge from '../../components/LineBadge.astro';
|
||||||
|
import SplitFlapText from '../../components/bits/SplitFlapText';
|
||||||
import { DISCIPLINES, LINES } from '../../lib/disciplines';
|
import { DISCIPLINES, LINES } from '../../lib/disciplines';
|
||||||
|
import sign from '../../assets/photos/cta-sign.jpg';
|
||||||
|
import map from '../../assets/photos/subway-map.jpg';
|
||||||
|
|
||||||
const work = (await getCollection('work')).sort(
|
const work = (await getCollection('work')).sort(
|
||||||
(a, b) => Number(b.data.featured) - Number(a.data.featured) || +b.data.date - +a.data.date,
|
(a, b) => Number(b.data.featured) - Number(a.data.featured) || +b.data.date - +a.data.date,
|
||||||
);
|
);
|
||||||
|
const statusLabel = { live: 'Live', shipped: 'Shipped', 'in-progress': 'Building', archived: 'Archived' } as const;
|
||||||
// Decorative route map: one line per discipline, stations = project count.
|
|
||||||
const routes = DISCIPLINES.map((d, i) => {
|
|
||||||
const y = 30 + i * 22;
|
|
||||||
const kink = 140 + i * 70;
|
|
||||||
return {
|
|
||||||
d,
|
|
||||||
color: LINES[d].color,
|
|
||||||
path: `M -10 ${y} H ${kink} l 40 ${i % 2 ? 40 : -40} H 1210`,
|
|
||||||
stops: work.filter((p) => p.data.disciplines.includes(d)).map((_, k) => ({ x: kink + 120 + k * 150, y: y + (i % 2 ? 40 : -40) })),
|
|
||||||
};
|
|
||||||
});
|
|
||||||
---
|
---
|
||||||
|
|
||||||
<Base title="Work" description="Software, web, games, hardware and 3D projects by Johan Sandoval." theme="transit">
|
<Base title="Work" description="Software, web, games, hardware and 3D projects by Johan Sandoval." theme="transit">
|
||||||
<section class="hero">
|
<section class="platform">
|
||||||
<svg class="map" viewBox="0 0 1200 190" preserveAspectRatio="xMidYMid slice" aria-hidden="true">
|
<Image class="sign-photo" src={sign} alt="" widths={[640, 1024, 1600]} sizes="100vw" loading="eager" />
|
||||||
{
|
<div class="wrap platform-in">
|
||||||
routes.map((r) => (
|
<p class="station">
|
||||||
<g>
|
<span class="sq">W</span>
|
||||||
<path d={r.path} stroke={r.color} stroke-width="9" fill="none" stroke-linejoin="round" />
|
<span>
|
||||||
{r.stops.map((s) => (
|
<b>Work</b>
|
||||||
<circle cx={s.x} cy={s.y} r="7" fill="#fff" stroke="#141412" stroke-width="3" />
|
<small>All projects · {work.length} stops</small>
|
||||||
))}
|
</span>
|
||||||
</g>
|
|
||||||
))
|
|
||||||
}
|
|
||||||
</svg>
|
|
||||||
<div class="wrap intro">
|
|
||||||
<h1>Work</h1>
|
|
||||||
<p class="sub">
|
|
||||||
Projects across software, web, games, hardware and 3D. Pick a line to filter.
|
|
||||||
</p>
|
</p>
|
||||||
|
<div class="board" aria-label="Work">
|
||||||
|
<SplitFlapText
|
||||||
|
client:load
|
||||||
|
words={['WORK', 'PROJECTS', 'BUILDS', 'TOOLS']}
|
||||||
|
padTo={8}
|
||||||
|
fontSize="clamp(1.9rem, 9.4vw, 5rem)"
|
||||||
|
tileColor="#1b1c1d"
|
||||||
|
textColor="#f9e300"
|
||||||
|
tileRadius={4}
|
||||||
|
gap="0.12em"
|
||||||
|
cycleDelay={2600}
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</section>
|
</section>
|
||||||
|
|
||||||
<section class="wrap">
|
<section class="arrivals" aria-label="Project list">
|
||||||
|
<div class="wrap">
|
||||||
|
<ol class="led">
|
||||||
|
{
|
||||||
|
work.map((p) => (
|
||||||
|
<li>
|
||||||
|
<a href={`/work/${p.id}`}>
|
||||||
|
<LineBadge d={p.data.disciplines[0]} size="1.7rem" />
|
||||||
|
<span class="dest">{p.data.title}</span>
|
||||||
|
<span class:list={['eta', p.data.status]}>{statusLabel[p.data.status]}</span>
|
||||||
|
</a>
|
||||||
|
</li>
|
||||||
|
))
|
||||||
|
}
|
||||||
|
</ol>
|
||||||
|
</div>
|
||||||
|
</section>
|
||||||
|
|
||||||
|
<section class="wrap listing">
|
||||||
<div class="filters" role="group" aria-label="Filter by category">
|
<div class="filters" role="group" aria-label="Filter by category">
|
||||||
<button class="chip" data-filter="all" aria-pressed="true">
|
<button class="chip" data-filter="all" aria-pressed="true">
|
||||||
<LineBadge letter="★" color="var(--ink)" fg="#fff" size="1.6rem" title="All" />
|
<LineBadge letter="★" color="var(--ink)" fg="#fff" size="1.7rem" title="All" />
|
||||||
All
|
All <span class="n">{work.length}</span>
|
||||||
<span class="n">{work.length}</span>
|
|
||||||
</button>
|
</button>
|
||||||
{
|
{
|
||||||
DISCIPLINES.map((d) => (
|
DISCIPLINES.map((d) => (
|
||||||
<button class="chip" data-filter={d} aria-pressed="false">
|
<button class="chip" data-filter={d} aria-pressed="false">
|
||||||
<LineBadge d={d} size="1.6rem" />
|
<LineBadge d={d} size="1.7rem" />
|
||||||
{LINES[d].label}
|
{LINES[d].label}
|
||||||
<span class="n">{work.filter((p) => p.data.disciplines.includes(d)).length}</span>
|
<span class="n">{work.filter((p) => p.data.disciplines.includes(d)).length}</span>
|
||||||
</button>
|
</button>
|
||||||
@@ -62,71 +77,178 @@ const routes = DISCIPLINES.map((d, i) => {
|
|||||||
}
|
}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="grid">
|
<div class="grid" data-reveal data-reveal-stagger>
|
||||||
{work.map((p, i) => <ProjectCard project={p} index={i + 1} />)}
|
{work.map((p, i) => <ProjectCard project={p} index={i + 1} />)}
|
||||||
</div>
|
</div>
|
||||||
<p class="empty" hidden>Nothing in this category yet. Check back soon.</p>
|
<p class="empty" hidden>Nothing on this line yet. Check back soon.</p>
|
||||||
</section>
|
</section>
|
||||||
|
|
||||||
|
<div class="map-bg" aria-hidden="true">
|
||||||
|
<Image src={map} alt="" widths={[800, 1200]} sizes="100vw" />
|
||||||
|
</div>
|
||||||
</Base>
|
</Base>
|
||||||
|
|
||||||
<style>
|
<style>
|
||||||
.hero {
|
.platform {
|
||||||
position: relative;
|
position: relative;
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
border-bottom: 2px solid var(--ink);
|
min-height: clamp(20rem, 70vw, 34rem);
|
||||||
background: #fffdf7;
|
display: grid;
|
||||||
|
align-items: end;
|
||||||
|
background: #2b2d2e;
|
||||||
|
border-bottom: 3px solid var(--ink);
|
||||||
}
|
}
|
||||||
.map {
|
.platform :global(.sign-photo) {
|
||||||
position: absolute;
|
position: absolute;
|
||||||
inset: 0;
|
inset: 0;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
height: 100%;
|
height: 100%;
|
||||||
opacity: 0.9;
|
object-fit: cover;
|
||||||
|
object-position: 45% 40%;
|
||||||
|
filter: saturate(0.9) contrast(1.05);
|
||||||
}
|
}
|
||||||
.intro {
|
.platform::after {
|
||||||
|
content: '';
|
||||||
|
position: absolute;
|
||||||
|
inset: 0;
|
||||||
|
background: linear-gradient(to top, rgb(0 0 0 / 0.75), transparent 60%);
|
||||||
|
}
|
||||||
|
.platform-in {
|
||||||
position: relative;
|
position: relative;
|
||||||
padding-block: var(--space-8) var(--space-6);
|
z-index: 1;
|
||||||
|
display: grid;
|
||||||
|
gap: var(--space-4);
|
||||||
|
padding-block: var(--space-8) var(--space-5);
|
||||||
}
|
}
|
||||||
h1 {
|
.station {
|
||||||
display: inline-block;
|
display: flex;
|
||||||
font-size: clamp(4rem, 16vw, 12rem);
|
align-items: center;
|
||||||
line-height: 0.8;
|
gap: 0.6rem;
|
||||||
padding: 0.08em 0.15em 0.12em;
|
justify-self: start;
|
||||||
background: var(--yellow);
|
padding: 0.5rem 0.9rem 0.5rem 0.5rem;
|
||||||
border: 3px solid var(--ink);
|
background: var(--cta-sign);
|
||||||
border-radius: 18px;
|
|
||||||
}
|
|
||||||
.sub {
|
|
||||||
display: inline-block;
|
|
||||||
margin-top: var(--space-4);
|
|
||||||
padding: 0.4em 0.8em;
|
|
||||||
background: var(--ink);
|
|
||||||
color: #fff;
|
color: #fff;
|
||||||
border-radius: 8px;
|
border-radius: 4px;
|
||||||
font-family: var(--ff-grotesk);
|
font-family: var(--ff-grotesk);
|
||||||
font-weight: 600;
|
animation: rise 0.6s var(--ease) both;
|
||||||
|
}
|
||||||
|
.station .sq {
|
||||||
|
display: grid;
|
||||||
|
place-items: center;
|
||||||
|
width: 2.6rem;
|
||||||
|
height: 2.6rem;
|
||||||
|
background: #fff;
|
||||||
|
color: var(--cta-sign);
|
||||||
|
font-weight: 800;
|
||||||
|
font-size: 1.6rem;
|
||||||
|
border-radius: 3px;
|
||||||
|
}
|
||||||
|
.station b {
|
||||||
|
display: block;
|
||||||
|
font-size: 1.15rem;
|
||||||
|
line-height: 1.1;
|
||||||
|
}
|
||||||
|
.station small {
|
||||||
|
display: block;
|
||||||
|
padding: 0.05rem 0.4rem;
|
||||||
|
margin-top: 0.15rem;
|
||||||
|
background: var(--cta-red);
|
||||||
|
font-size: 0.75rem;
|
||||||
|
font-weight: 700;
|
||||||
|
}
|
||||||
|
.board {
|
||||||
|
padding: 0.5rem;
|
||||||
|
background: #0d0d0e;
|
||||||
|
border-radius: 6px;
|
||||||
|
box-shadow: 0 10px 30px rgb(0 0 0 / 0.5);
|
||||||
|
justify-self: start;
|
||||||
|
max-width: 100%;
|
||||||
|
overflow: hidden;
|
||||||
|
animation: rise 0.7s 0.15s var(--ease) both;
|
||||||
|
}
|
||||||
|
@keyframes rise {
|
||||||
|
from {
|
||||||
|
opacity: 0;
|
||||||
|
transform: translateY(20px);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* CTA train-tracker style arrival rows */
|
||||||
|
.arrivals {
|
||||||
|
background: #0d0d0e;
|
||||||
|
color: #ffb000;
|
||||||
|
padding-block: var(--space-3);
|
||||||
|
border-bottom: 3px solid var(--ink);
|
||||||
|
}
|
||||||
|
.led {
|
||||||
|
list-style: none;
|
||||||
|
padding: 0;
|
||||||
|
}
|
||||||
|
.led a {
|
||||||
|
display: grid;
|
||||||
|
grid-template-columns: auto 1fr auto;
|
||||||
|
align-items: center;
|
||||||
|
gap: var(--space-3);
|
||||||
|
min-height: 3rem;
|
||||||
|
padding-block: 0.3rem;
|
||||||
|
border-bottom: 1px dashed #3a3a3a;
|
||||||
|
font-family: var(--ff-dot);
|
||||||
|
font-weight: 700;
|
||||||
|
font-size: clamp(1rem, 4.4vw, 1.45rem);
|
||||||
|
text-decoration: none;
|
||||||
|
color: inherit;
|
||||||
|
text-transform: uppercase;
|
||||||
|
}
|
||||||
|
.led li:last-child a {
|
||||||
|
border-bottom: 0;
|
||||||
|
}
|
||||||
|
.led a:hover,
|
||||||
|
.led a:active {
|
||||||
|
color: #fff;
|
||||||
|
}
|
||||||
|
.dest {
|
||||||
|
overflow: hidden;
|
||||||
|
text-overflow: ellipsis;
|
||||||
|
white-space: nowrap;
|
||||||
|
}
|
||||||
|
.eta.live,
|
||||||
|
.eta.shipped {
|
||||||
|
color: #39ff88;
|
||||||
|
}
|
||||||
|
|
||||||
|
.listing {
|
||||||
|
position: relative;
|
||||||
|
z-index: 1;
|
||||||
|
}
|
||||||
.filters {
|
.filters {
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-wrap: wrap;
|
|
||||||
gap: var(--space-2);
|
gap: var(--space-2);
|
||||||
margin-block: var(--space-6);
|
margin-block: var(--space-6);
|
||||||
|
margin-inline: calc(-1 * var(--gutter));
|
||||||
|
padding: 0.25rem var(--gutter) 0.5rem;
|
||||||
|
overflow-x: auto;
|
||||||
|
scrollbar-width: none;
|
||||||
|
scroll-snap-type: x proximity;
|
||||||
|
}
|
||||||
|
.filters::-webkit-scrollbar {
|
||||||
|
display: none;
|
||||||
}
|
}
|
||||||
.chip {
|
.chip {
|
||||||
|
flex: none;
|
||||||
|
scroll-snap-align: start;
|
||||||
display: inline-flex;
|
display: inline-flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
gap: 0.5em;
|
gap: 0.5em;
|
||||||
padding: 0.3em 0.8em 0.3em 0.3em;
|
min-height: 44px;
|
||||||
|
padding: 0.3em 0.9em 0.3em 0.35em;
|
||||||
border: 2px solid var(--ink);
|
border: 2px solid var(--ink);
|
||||||
border-radius: 999px;
|
border-radius: 999px;
|
||||||
background: #fff;
|
background: #fff;
|
||||||
font-family: var(--ff-grotesk);
|
font-family: var(--ff-grotesk);
|
||||||
font-weight: 700;
|
font-weight: 700;
|
||||||
|
font-size: 0.95rem;
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
}
|
white-space: nowrap;
|
||||||
.chip:hover {
|
|
||||||
background: var(--bg-sunken);
|
|
||||||
}
|
}
|
||||||
.chip[aria-pressed='true'] {
|
.chip[aria-pressed='true'] {
|
||||||
background: var(--ink);
|
background: var(--ink);
|
||||||
@@ -149,6 +271,27 @@ const routes = DISCIPLINES.map((d, i) => {
|
|||||||
font-family: var(--ff-grotesk);
|
font-family: var(--ff-grotesk);
|
||||||
font-weight: 600;
|
font-weight: 600;
|
||||||
}
|
}
|
||||||
|
.map-bg {
|
||||||
|
position: fixed;
|
||||||
|
inset: 0;
|
||||||
|
z-index: -1;
|
||||||
|
opacity: 0.12;
|
||||||
|
pointer-events: none;
|
||||||
|
mix-blend-mode: multiply;
|
||||||
|
}
|
||||||
|
.map-bg :global(img) {
|
||||||
|
width: 100%;
|
||||||
|
height: 100%;
|
||||||
|
object-fit: cover;
|
||||||
|
}
|
||||||
|
@media (min-width: 60rem) {
|
||||||
|
.filters {
|
||||||
|
flex-wrap: wrap;
|
||||||
|
overflow: visible;
|
||||||
|
margin-inline: 0;
|
||||||
|
padding-inline: 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
|
|||||||
@@ -0,0 +1,75 @@
|
|||||||
|
/**
|
||||||
|
* Site-wide motion: Lenis smooth scrolling (desktop; touch keeps native
|
||||||
|
* scrolling) driven by GSAP's ticker, plus ScrollTrigger reveals.
|
||||||
|
*
|
||||||
|
* data-reveal fade + rise when scrolled into view
|
||||||
|
* data-reveal="tilt" same, with a slight paper-like rotation
|
||||||
|
* data-reveal-stagger reveal direct children one after another
|
||||||
|
* data-parallax="0.2" drift vertically while scrolling (desktop only)
|
||||||
|
*
|
||||||
|
* Everything is skipped when the visitor prefers reduced motion.
|
||||||
|
*/
|
||||||
|
import Lenis from 'lenis';
|
||||||
|
import 'lenis/dist/lenis.css';
|
||||||
|
import { gsap } from 'gsap';
|
||||||
|
import { ScrollTrigger } from 'gsap/ScrollTrigger';
|
||||||
|
|
||||||
|
gsap.registerPlugin(ScrollTrigger);
|
||||||
|
|
||||||
|
const reduce = window.matchMedia('(prefers-reduced-motion: reduce)');
|
||||||
|
let lenis: Lenis | null = null;
|
||||||
|
let ctx: gsap.Context | null = null;
|
||||||
|
|
||||||
|
function startLenis() {
|
||||||
|
if (lenis || reduce.matches) return;
|
||||||
|
lenis = new Lenis({ lerp: 0.12, wheelMultiplier: 1, autoRaf: false });
|
||||||
|
lenis.on('scroll', ScrollTrigger.update);
|
||||||
|
gsap.ticker.add((time) => lenis?.raf(time * 1000));
|
||||||
|
gsap.ticker.lagSmoothing(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
function setup() {
|
||||||
|
ctx?.revert();
|
||||||
|
ctx = gsap.context(() => {
|
||||||
|
if (reduce.matches) return;
|
||||||
|
|
||||||
|
gsap.utils.toArray<HTMLElement>('[data-reveal]').forEach((el) => {
|
||||||
|
const targets = el.hasAttribute('data-reveal-stagger') ? Array.from(el.children) : [el];
|
||||||
|
gsap.from(targets, {
|
||||||
|
y: 36,
|
||||||
|
autoAlpha: 0,
|
||||||
|
rotate: el.dataset.reveal === 'tilt' ? -2.5 : 0,
|
||||||
|
duration: 0.85,
|
||||||
|
ease: 'power3.out',
|
||||||
|
stagger: 0.07,
|
||||||
|
scrollTrigger: { trigger: el, start: 'top 90%', once: true },
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
const mm = gsap.matchMedia();
|
||||||
|
mm.add('(min-width: 52rem)', () => {
|
||||||
|
gsap.utils.toArray<HTMLElement>('[data-parallax]').forEach((el) => {
|
||||||
|
const amount = parseFloat(el.dataset.parallax || '0.15');
|
||||||
|
gsap.to(el, {
|
||||||
|
yPercent: -100 * amount,
|
||||||
|
ease: 'none',
|
||||||
|
scrollTrigger: { trigger: el, start: 'top bottom', end: 'bottom top', scrub: true },
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
||||||
|
lenis?.resize();
|
||||||
|
ScrollTrigger.refresh();
|
||||||
|
}
|
||||||
|
|
||||||
|
document.addEventListener('astro:page-load', () => {
|
||||||
|
startLenis();
|
||||||
|
setup();
|
||||||
|
});
|
||||||
|
document.addEventListener('astro:before-swap', () => {
|
||||||
|
ctx?.revert();
|
||||||
|
ctx = null;
|
||||||
|
});
|
||||||
|
|
||||||
|
// Expose for menus that need to lock scrolling.
|
||||||
|
(window as unknown as { __lenis?: () => Lenis | null }).__lenis = () => lenis;
|
||||||
@@ -105,6 +105,11 @@
|
|||||||
background: repeating-linear-gradient(to bottom, transparent 0 2px, rgb(0 0 0 / 0.55) 2px 3px);
|
background: repeating-linear-gradient(to bottom, transparent 0 2px, rgb(0 0 0 / 0.55) 2px 3px);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Overhanging collage pieces must never widen the page on phones. */
|
||||||
|
main {
|
||||||
|
overflow-x: clip;
|
||||||
|
}
|
||||||
|
|
||||||
h1,
|
h1,
|
||||||
h2,
|
h2,
|
||||||
h3,
|
h3,
|
||||||
|
|||||||
@@ -32,13 +32,26 @@
|
|||||||
--amber: #ff9a2a;
|
--amber: #ff9a2a;
|
||||||
--cyan: #67e8f9;
|
--cyan: #67e8f9;
|
||||||
|
|
||||||
/* subway lines: one per section / discipline */
|
/* Chicago 'L' line colors (CTA) */
|
||||||
--line-work: var(--red);
|
--cta-red: #c60c30;
|
||||||
--line-blog: var(--cobalt);
|
--cta-blue: #00a1de;
|
||||||
--line-music: var(--yellow);
|
--cta-brown: #62361b;
|
||||||
--line-3d: var(--violet);
|
--cta-green: #009b3a;
|
||||||
--line-about: var(--emerald);
|
--cta-orange: #f9461c;
|
||||||
--line-contact: var(--sky);
|
--cta-purple: #522398;
|
||||||
|
--cta-pink: #e27ea6;
|
||||||
|
--cta-yellow: #f9e300;
|
||||||
|
--cta-sign: #565a5c;
|
||||||
|
--chicago-blue: #b3ddf2;
|
||||||
|
--chicago-star: #ff0000;
|
||||||
|
|
||||||
|
/* each section rides its own line */
|
||||||
|
--line-work: var(--cta-red);
|
||||||
|
--line-blog: var(--cta-blue);
|
||||||
|
--line-music: var(--cta-pink);
|
||||||
|
--line-3d: var(--cta-purple);
|
||||||
|
--line-about: var(--cta-green);
|
||||||
|
--line-contact: var(--cta-orange);
|
||||||
|
|
||||||
/* type families */
|
/* type families */
|
||||||
--ff-mag: 'Dela Gothic One', 'Arial Black', sans-serif;
|
--ff-mag: 'Dela Gothic One', 'Arial Black', sans-serif;
|
||||||
|
|||||||