feat: 添加 FooterSection 组件,更新页面结构以包含联系信息;优化 ScrambleReveal 组件以支持反向字符揭示

This commit is contained in:
2026-09-01 15:19:31 +08:00
parent 602f1c82ed
commit e3e5a3663e
6 changed files with 167 additions and 4 deletions
+4
View File
@@ -1,5 +1,6 @@
import ScrambleReveal from "@/components/dom/ScrambleReveal"; import ScrambleReveal from "@/components/dom/ScrambleReveal";
import AboutMedia from "@/components/dom/AboutMedia"; import AboutMedia from "@/components/dom/AboutMedia";
import FooterSection from "@/components/dom/FooterSection";
/** /**
* Page content matching the original DOM (haoqi_body.html): * Page content matching the original DOM (haoqi_body.html):
@@ -100,6 +101,9 @@ export default function Home() {
</p> </p>
</div> </div>
</div> </div>
{/* Contact / Footer Section (#contact, data-section="footer") */}
<FooterSection />
</div> </div>
</main> </main>
); );
+39 -1
View File
@@ -1,6 +1,6 @@
"use client"; "use client";
import { useEffect, useMemo, useRef } from "react"; import { useEffect, useMemo, useRef, useState } from "react";
import { useFrame, useLoader, useThree } from "@react-three/fiber"; import { useFrame, useLoader, useThree } from "@react-three/fiber";
import * as THREE from "three"; import * as THREE from "three";
import { GLTFLoader } from "three/examples/jsm/loaders/GLTFLoader.js"; import { GLTFLoader } from "three/examples/jsm/loaders/GLTFLoader.js";
@@ -677,3 +677,41 @@ export function CursorStar({ isMobile = false }: { isMobile?: boolean }) {
/> />
); );
} }
/**
* #contact footer model (original cp call: model/cnt.gltf, scale 19,
* beforeRotation [-180,0,0], scrollSyncFactor 1 — the cp default — and
* light-theme tingColor m[0]/m[1] = #FFFFFF/#009dff). Anchored to the
* footer section's document geometry, measured live so it tracks layout.
*/
export function FooterModel() {
const [geom, setGeom] = useState({ top: 0, height: 0 });
useEffect(() => {
const measure = () => {
const el = document.getElementById("contact");
if (el) setGeom({ top: el.offsetTop, height: el.offsetHeight });
};
measure();
window.addEventListener("resize", measure);
document.fonts?.ready?.then(measure).catch(() => {});
const t = window.setTimeout(measure, 500);
return () => {
window.removeEventListener("resize", measure);
window.clearTimeout(t);
};
}, []);
return (
<GlassModel
url="/model/cnt.gltf"
position={[0, 0, 0]}
beforeRotation={[-180, 0, 0]}
rotation={[0, 0, 0]}
scale={19}
tintColors={["#FFFFFF", "#009dff"]}
tintEnabled
sectionTopDocY={geom.top}
sectionHeightPx={geom.height}
scrollSyncFactor={1}
/>
);
}
+4 -1
View File
@@ -5,7 +5,7 @@ import { Canvas, useThree } from "@react-three/fiber";
import { PerspectiveCamera } from "@react-three/drei"; import { PerspectiveCamera } from "@react-three/drei";
import { StickerDrop, StickerCamera } from "@/components/canvas/StickerDrop"; import { StickerDrop, StickerCamera } from "@/components/canvas/StickerDrop";
import { HelloModel, CursorStar } from "@/components/canvas/GlassModels"; import { HelloModel, CursorStar, FooterModel } from "@/components/canvas/GlassModels";
import ImageLayers from "@/components/canvas/ImageLayers"; import ImageLayers from "@/components/canvas/ImageLayers";
import BackgroundFX from "@/components/canvas/BackgroundFX"; import BackgroundFX from "@/components/canvas/BackgroundFX";
import DotOverlay from "@/components/canvas/DotOverlay"; import DotOverlay from "@/components/canvas/DotOverlay";
@@ -148,6 +148,9 @@ export function HeroScene() {
{/* Glass hero models (hello + blue cursor star), refractive tint shader */} {/* Glass hero models (hello + blue cursor star), refractive tint shader */}
<HelloModel isMobile={isMobile} /> <HelloModel isMobile={isMobile} />
<CursorStar isMobile={isMobile} /> <CursorStar isMobile={isMobile} />
{/* #contact footer model (original: cnt.gltf scale 19, x-180° flip,
section-anchored, scrollSyncFactor 1) */}
<FooterModel />
{/* Post FX (original cG): lens-flare star streaks + pointer-driven {/* Post FX (original cG): lens-flare star streaks + pointer-driven
fluid refraction + lime dot-trail indicator. */} fluid refraction + lime dot-trail indicator. */}
+112
View File
@@ -0,0 +1,112 @@
"use client";
import ScrambleReveal from "@/components/dom/ScrambleReveal";
/**
* #contact footer — 1:1 port of the original footer (chunk 2689132c4e070b68.js
* module 28192):
*
* - `<footer id="contact">` fills the last viewport (h-dvh / lg:h-screen),
* z-10 (below the fixed canvas at z-30, above the grid) and carries
* `data-section="footer"` — SmoothScroller's sP f2 factor and PostFX's
* bright-source gating both read this attribute.
* - Headline: three 12-col grid rows at 6svw, "Let's / Create / Something /
* Extraordinary"; "Create" and "Extraordinary" use reverse reveal (chars
* run last→first).
* - Bottom bar: mailto + Twitter/X / Figma / GitHub links with the dotted
* hover border.
*
* NOTE: contact targets are placeholders — swap in VIRTHEART's real email
* and social URLs.
*/
const dottedLink =
"block before:absolute relative before:inset-0 p-2 lg:hover:before:border-l1 before:border-2 before:border-transparent active:before:border-l1 before:border-dotted uppercase before:content-[''] before:transition-colors before:duration-200 cursor-pointer pointer-events-auto before:pointer-events-none";
const SOCIALS = [
{ href: "#", label: "Twitter/X" },
{ href: "#", label: "Figma" },
{ href: "#", label: "GitHub" },
];
export default function FooterSection() {
return (
<footer
id="contact"
data-section="footer"
className="z-30 relative flex flex-col justify-center p-6 lg:p-16 w-full h-dvh lg:h-screen pointer-events-none"
>
<div
className="gap-2 grid grid-cols-12 font-bold text-[7.2svw] lg:text-[6svw] 2xl:text-[5svw] xl:text-[5.6svw] uppercase leading-none"
style={{ fontVariationSettings: '"wdth" 120' }}
>
<ScrambleReveal
text="Let's"
className="col-span-6 md:col-span-5 xl:col-span-4 md:col-start-2 xl:col-start-3 text-left pointer-events-auto"
startDelayMs={300}
scrambleColors={false}
/>
<ScrambleReveal
text="Create"
className="col-span-6 md:col-span-5 xl:col-span-4 text-right pointer-events-auto"
startDelayMs={300}
reverse
scrambleColors={false}
/>
</div>
<div
className="gap-2 grid grid-cols-12 font-bold text-[7.2svw] lg:text-[6svw] 2xl:text-[5svw] xl:text-[5.6svw] uppercase leading-none"
style={{ fontVariationSettings: '"wdth" 120' }}
>
<ScrambleReveal
text="Something"
className="col-span-12 md:col-start-2 xl:col-start-3 text-left pointer-events-auto"
startDelayMs={300}
scrambleColors={false}
/>
</div>
<div
className="gap-2 grid grid-cols-12 font-bold text-[7.2svw] lg:text-[6svw] 2xl:text-[5svw] xl:text-[5.6svw] uppercase leading-none"
style={{ fontVariationSettings: '"wdth" 120' }}
>
<ScrambleReveal
text="Extraordinary"
className="col-span-12 md:col-end-12 xl:col-end-11 text-right pointer-events-auto"
startDelayMs={300}
reverse
scrambleColors={false}
/>
</div>
<div className="absolute inset-0 flex flex-col justify-end px-4 lg:px-14 py-18 lg:py-24 font-mono-2 text-sm lg:text-base">
<div className="flex lg:flex-row flex-col justify-between w-full">
{/* TODO: replace with the real VIRTHEART contact address. */}
<a className={dottedLink} href="mailto:hello@virtheart.com">
<ScrambleReveal
text="hello@virtheart.com"
startDelayMs={300}
scrambleColors={false}
/>
</a>
<div className="flex flex-row items-center gap-2 lg:gap-4">
{/* TODO: replace with the real VIRTHEART social URLs. */}
{SOCIALS.map(({ href, label }) => (
<a
key={label}
className={dottedLink}
href={href}
target={href.startsWith("http") ? "_blank" : undefined}
rel={href.startsWith("http") ? "noopener noreferrer" : undefined}
>
<ScrambleReveal
text={label}
startDelayMs={300}
scrambleColors={false}
/>
</a>
))}
</div>
</div>
</div>
</footer>
);
}
+1 -1
View File
@@ -201,7 +201,7 @@ export default function Header() {
<button <button
type="button" type="button"
className={`${dotted} p-2 uppercase cursor-pointer`} className={`${dotted} p-2 uppercase cursor-pointer`}
onClick={() => scrollEnv.scrollToBottom("smooth")} onClick={() => scrollEnv.scrollToSection("#contact")}
> >
<ScrambleReveal text="Contact" startDelayMs={300} scrambleColors={false} /> <ScrambleReveal text="Contact" startDelayMs={300} scrambleColors={false} />
</button> </button>
+7 -1
View File
@@ -28,6 +28,8 @@ type Props = {
startDelayMs?: number; startDelayMs?: number;
letterDelayMs?: number; letterDelayMs?: number;
scrambleColors?: boolean; scrambleColors?: boolean;
/** Reveal from the last character to the first (original `reverse`). */
reverse?: boolean;
}; };
export default function ScrambleReveal({ export default function ScrambleReveal({
@@ -37,6 +39,7 @@ export default function ScrambleReveal({
startDelayMs = 0, startDelayMs = 0,
letterDelayMs = 80, letterDelayMs = 80,
scrambleColors = true, scrambleColors = true,
reverse = false,
}: Props) { }: Props) {
const strings = useMemo( const strings = useMemo(
() => (parts ? parts : [text ?? ""]), () => (parts ? parts : [text ?? ""]),
@@ -100,15 +103,18 @@ export default function ScrambleReveal({
// recompute random chars on each elapsed tick // recompute random chars on each elapsed tick
let index = 0; let index = 0;
const totalChars = strings.join("").length;
return ( return (
<span ref={ref} className={className}> <span ref={ref} className={className}>
{strings.map((s, si) => ( {strings.map((s, si) => (
<span key={si}> <span key={si}>
{s.split("").map((ch, ci) => { {s.split("").map((ch, ci) => {
const i = index++; const i = index++;
// Original `reverse`: character delays run last→first.
const order = reverse ? totalChars - 1 - i : i;
if (ch === "\n") return <br key={`br-${si}-${ci}`} />; if (ch === "\n") return <br key={`br-${si}-${ci}`} />;
if (ch === " ") return <span key={`sp-${si}-${ci}`}> </span>; if (ch === " ") return <span key={`sp-${si}-${ci}`}> </span>;
const n = i * letterDelayMs; const n = order * letterDelayMs;
if (V < n) { if (V < n) {
return ( return (
<span key={`c-${si}-${ci}`} style={{ opacity: 0 }}> <span key={`c-${si}-${ci}`} style={{ opacity: 0 }}>