Skip to content

Commit 1fd6c95

Browse files
committed
feat(about): add community film band blended into the ink surface
1 parent 3943462 commit 1fd6c95

4 files changed

Lines changed: 70 additions & 0 deletions

File tree

‎app/about/page.tsx‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import { aboutContent, coreTeam } from "@/components/about/data";
55
import { OriginTimeline } from "@/components/about/origin-timeline";
66
import { Team } from "@/components/about/team";
77
import { Governance } from "@/components/about/governance";
8+
import { AboutFilm } from "@/components/about/film";
89
import { cn } from "@/lib/utils";
910

1011
const CHAPTERS = [
@@ -83,6 +84,7 @@ export default function About() {
8384
<OriginTimeline />
8485

8586
<TornEdge from="paper" to="ink" />
87+
<AboutFilm />
8688
<ChapterHero
8789
id="beliefs"
8890
number={2}

‎components/about/film.tsx‎

Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
"use client";
2+
3+
import { useEffect, useRef, useState } from "react";
4+
5+
import { useMotionEnabled } from "@/components/experience-provider";
6+
import { cn } from "@/lib/utils";
7+
import { EDITION_GUTTER } from "@/components/edition";
8+
9+
// Clip opens and closes on pure black: `lighten` turns that black into the ink surface colour and the
10+
// edge mask feathers the frame, so the first/last frames are indistinguishable from the page.
11+
const FADE =
12+
"linear-gradient(to right, transparent, #000 10%, #000 90%, transparent), linear-gradient(to bottom, transparent, #000 12%, #000 88%, transparent)";
13+
14+
export function AboutFilm() {
15+
const ref = useRef<HTMLVideoElement>(null);
16+
const motion = useMotionEnabled();
17+
const [muted, setMuted] = useState(true);
18+
19+
// Play only while on screen; nothing loads until it is near the viewport.
20+
useEffect(() => {
21+
const v = ref.current;
22+
if (!v || !motion) return;
23+
const io = new IntersectionObserver(
24+
([e]) => {
25+
if (e.isIntersecting) {
26+
v.preload = "auto";
27+
v.play().catch(() => {});
28+
} else v.pause();
29+
},
30+
{ threshold: 0.35 },
31+
);
32+
io.observe(v);
33+
return () => io.disconnect();
34+
}, [motion]);
35+
36+
return (
37+
<section data-surface="ink" aria-label="Film" className="tone-ink relative py-16 md:py-24">
38+
<div className={cn("relative mx-auto max-w-[1600px] px-4 md:px-8", EDITION_GUTTER)}>
39+
<video
40+
ref={ref}
41+
className="aspect-[23/12.5] w-full bg-transparent object-cover"
42+
style={{ maskImage: FADE, WebkitMaskImage: FADE, maskComposite: "intersect", WebkitMaskComposite: "source-in", mixBlendMode: "lighten" }}
43+
muted={muted}
44+
loop
45+
playsInline
46+
preload="none"
47+
controls={!motion}
48+
aria-label="Short film from the bits&bytes™ community"
49+
>
50+
<source src="/video/ash-no-cash-960.mp4" type="video/mp4" media="(max-width: 768px)" />
51+
<source src="/video/ash-no-cash.mp4" type="video/mp4" />
52+
</video>
53+
{motion ? (
54+
<button
55+
type="button"
56+
onClick={() => {
57+
setMuted((m) => !m);
58+
ref.current?.play().catch(() => {});
59+
}}
60+
className="absolute bottom-2 right-4 font-mono text-xs font-bold uppercase tracking-[0.2em] text-paper/70 hover:text-signal md:right-8"
61+
>
62+
[{muted ? "Sound on" : "Sound off"}]
63+
</button>
64+
) : null}
65+
</div>
66+
</section>
67+
);
68+
}

‎public/video/ash-no-cash-960.mp4‎

1.93 MB
Binary file not shown.

‎public/video/ash-no-cash.mp4‎

5.78 MB
Binary file not shown.

0 commit comments

Comments
 (0)