Files
site/components/v2/LineMask.jsx
Claude 3f456ca19c Cloud 3 kit to MASTER.md: deck greys, scale rhythm, flat surfaces, no springs
Type rests at live hanzo.ai sizes (h1 52, section headings 26, chapter titles 32, intro 44, figures 64 Air) in Book 497; LaunchClose's 'Get X' grows from 26 to 64px as you reach it. Container 1152, gutter clamp(16,4vw,32), sections clamp(72,11vw,188). Deck palette only (#0a0a0a/#525252/#737373/#a3a3a3 on black/#d4d4d4/#ededed/#f2f2f2/#f5f5f5). Objects outlined or flat, never shadowed; only the sheet floats. Press .97 for 90ms; hover changes fill or ink (no lift, no arrow nudge, no cursor label); magnetic ask capped at 22px and eased; LaunchConsole without spring; LineMask 700ms with 60ms between lines. PinnedChapters gets objH for phones; ClipWipe content arrives faster.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01DqUybD2u9xLqEDzChWdtcP
2026-11-07 14:48:31 +00:00

39 lines
2.0 KiB
React

'use client';
/* LineMask: kinetic type, played once. Each line cuts up out of its own mask (VISION motion 4, JAMES "headlines cut
into their line").
Usage: <LineMask as="h1" className="lx-display" lines={['Hanzo', 'Metrics']} /> — a hero: plays at first paint;
<LineMask lines={[...]} inView /> — plays when first scrolled to.
The words are real text in the server HTML and are never hidden from a reader without JS:
- the hero cut-in is a CSS animation, so it starts at first paint, does not wait for hydration and ends visible
even with JS off;
- the inView variant is armed (hidden) only after mount and only while it is still below the fold.
Timing (MASTER part 3): translateY 105% → 0, 700 ms, ease-emphasis, 60 ms between lines.
Reduced motion: set, no movement. Owned by Cloud 3. */
import { useEffect, useRef, useState } from 'react';
import './LaunchType.css';
export default function LineMask({ lines, as = 'h2', className = '', delay = 0, inView = false, stagger = 0.06, ...rest }) {
const ref = useRef(null);
const [st, setSt] = useState(inView ? 'idle' : 'play'); // idle (visible, untouched) → armed (hidden) → play
useEffect(() => {
if (!inView) return;
const el = ref.current;
if (!el || matchMedia('(prefers-reduced-motion: reduce)').matches) return;
if (el.getBoundingClientRect().top < innerHeight * 0.9) return; // already in view: leave it set
setSt('armed');
const io = new IntersectionObserver(([e]) => { if (e.isIntersecting) { setSt('play'); io.disconnect(); } }, { threshold: 0.5 });
io.observe(el);
return () => io.disconnect();
}, [inView]);
const Tag = as;
return (
<Tag ref={ref} className={`lx-lm ${className}`} data-lm={st} {...rest}>
{lines.map((t, i) => (
<span className="lx-line" key={i}>
<span style={{ animationDelay: `${delay + i * stagger}s` }}>{t}</span>
</span>
))}
</Tag>
);
}