feat: add gsap motion to BossAI website

This commit is contained in:
boos
2026-06-06 06:18:40 +08:00
parent d467e27fd8
commit b40c522749
5 changed files with 224 additions and 120 deletions
+99
View File
@@ -0,0 +1,99 @@
"use client";
import { type ReactNode, useRef } from "react";
import gsap from "gsap";
import { useGSAP } from "@gsap/react";
import { ScrollTrigger } from "gsap/ScrollTrigger";
gsap.registerPlugin(useGSAP, ScrollTrigger);
type BossAiMotionProps = {
children: ReactNode;
};
export function BossAiMotion({ children }: BossAiMotionProps) {
const scopeRef = useRef<HTMLDivElement>(null);
useGSAP(
() => {
const reduceMotion = window.matchMedia("(prefers-reduced-motion: reduce)").matches;
gsap.set("[data-motion]", { autoAlpha: 1 });
gsap.set("[data-motion-line]", { transformOrigin: "center" });
if (reduceMotion) {
return;
}
const intro = gsap.timeline({ defaults: { ease: "power3.out" } });
intro
.from("[data-motion='nav']", { autoAlpha: 0, y: -18, duration: 0.7 })
.from("[data-motion='hero-copy']", { autoAlpha: 0, y: 36, duration: 0.9 }, "-=0.35")
.from("[data-motion='hero-console']", { autoAlpha: 0, y: 34, rotateX: 5, duration: 0.9 }, "-=0.65")
.from("[data-motion='route-row']", { autoAlpha: 0, x: 24, duration: 0.55, stagger: 0.08 }, "-=0.45")
.from("[data-motion='node']", { autoAlpha: 0, scale: 0.94, duration: 0.45, stagger: 0.08 }, "-=0.3");
gsap.to("[data-motion-orbit]", {
rotate: 360,
duration: 28,
ease: "none",
repeat: -1,
});
gsap.to("[data-motion-dot]", {
scale: 1.18,
autoAlpha: 0.72,
duration: 1.4,
ease: "sine.inOut",
repeat: -1,
yoyo: true,
stagger: 0.24,
});
gsap.to("[data-motion-line]", {
strokeDashoffset: -160,
duration: 5.8,
ease: "none",
repeat: -1,
stagger: 0.28,
});
gsap.utils.toArray<HTMLElement>("[data-motion='section']").forEach((section) => {
gsap.from(section, {
autoAlpha: 0,
y: 42,
duration: 0.8,
ease: "power3.out",
scrollTrigger: {
trigger: section,
start: "top 82%",
once: true,
},
});
});
gsap.utils.toArray<HTMLElement>("[data-motion='card']").forEach((card, index) => {
gsap.from(card, {
autoAlpha: 0,
y: 28,
scale: 0.97,
duration: 0.62,
delay: index * 0.04,
ease: "power3.out",
scrollTrigger: {
trigger: card,
start: "top 88%",
once: true,
},
});
});
},
{ scope: scopeRef },
);
return (
<div ref={scopeRef} className="motion-root">
{children}
</div>
);
}
+11 -48
View File
@@ -59,6 +59,17 @@ a {
linear-gradient(145deg, #040807 0%, #08110f 42%, #13221d 100%); linear-gradient(145deg, #040807 0%, #08110f 42%, #13221d 100%);
} }
.motion-root {
min-height: 100dvh;
}
[data-motion],
[data-motion-line],
[data-motion-dot],
[data-motion-orbit] {
will-change: transform, opacity;
}
.site-shell::before { .site-shell::before {
position: fixed; position: fixed;
inset: 0; inset: 0;
@@ -284,7 +295,6 @@ a {
border: 1px solid rgba(215, 255, 77, 0.12); border: 1px solid rgba(215, 255, 77, 0.12);
border-radius: 999px; border-radius: 999px;
background: radial-gradient(circle, rgba(215, 255, 77, 0.12), transparent 60%); background: radial-gradient(circle, rgba(215, 255, 77, 0.12), transparent 60%);
animation: slow-spin 24s linear infinite;
} }
.console-orbit::after { .console-orbit::after {
@@ -407,16 +417,13 @@ a {
stroke-width: 2.5; stroke-width: 2.5;
stroke-linecap: round; stroke-linecap: round;
stroke-dasharray: 12 18; stroke-dasharray: 12 18;
animation: flow-dash 8s linear infinite;
} }
.flow-line-b { .flow-line-b {
animation-duration: 10s;
opacity: 0.62; opacity: 0.62;
} }
.flow-line-c { .flow-line-c {
animation-duration: 7s;
opacity: 0.48; opacity: 0.48;
} }
@@ -431,15 +438,6 @@ a {
.node { .node {
fill: rgba(255, 255, 255, 0.04); fill: rgba(255, 255, 255, 0.04);
stroke: rgba(215, 255, 77, 0.22); stroke: rgba(215, 255, 77, 0.22);
animation: node-float 5s ease-in-out infinite;
}
.node-b {
animation-delay: -1.5s;
}
.node-c {
animation-delay: -2.5s;
} }
.platform-section, .platform-section,
@@ -497,8 +495,6 @@ a {
linear-gradient(180deg, rgba(255, 255, 255, 0.06), rgba(255, 255, 255, 0.02)), linear-gradient(180deg, rgba(255, 255, 255, 0.06), rgba(255, 255, 255, 0.02)),
rgba(255, 255, 255, 0.025); rgba(255, 255, 255, 0.025);
padding: 20px; padding: 20px;
animation: card-rise 700ms ease both;
animation-delay: calc(var(--index) * 80ms);
} }
.card-top { .card-top {
@@ -799,36 +795,3 @@ a {
box-shadow: 0 0 0 0 rgba(215, 255, 77, 0); box-shadow: 0 0 0 0 rgba(215, 255, 77, 0);
} }
} }
@keyframes slow-spin {
to {
transform: rotate(360deg);
}
}
@keyframes flow-dash {
to {
stroke-dashoffset: -220;
}
}
@keyframes node-float {
0%,
100% {
transform: translateY(0);
}
50% {
transform: translateY(-8px);
}
}
@keyframes card-rise {
from {
opacity: 0;
transform: translateY(16px);
}
to {
opacity: 1;
transform: translateY(0);
}
}
+52 -30
View File
@@ -1,5 +1,6 @@
import Image from "next/image"; import Image from "next/image";
import Link from "next/link"; import Link from "next/link";
import { BossAiMotion } from "./BossAiMotion";
const platformItems = [ const platformItems = [
{ {
@@ -70,32 +71,44 @@ function FlowGlyph() {
</feMerge> </feMerge>
</filter> </filter>
</defs> </defs>
<path className="flow-line flow-line-a" d="M48 180 C130 62 232 62 314 180 S438 298 488 154" /> <path
<path className="flow-line flow-line-b" d="M58 236 C154 318 222 286 274 184 S358 24 462 92" /> className="flow-line flow-line-a"
<path className="flow-line flow-line-c" d="M92 108 C178 164 214 180 260 180 S330 174 424 250" /> data-motion-line
d="M48 180 C130 62 232 62 314 180 S438 298 488 154"
/>
<path
className="flow-line flow-line-b"
data-motion-line
d="M58 236 C154 318 222 286 274 184 S358 24 462 92"
/>
<path
className="flow-line flow-line-c"
data-motion-line
d="M92 108 C178 164 214 180 260 180 S330 174 424 250"
/>
<g filter="url(#softGlow)"> <g filter="url(#softGlow)">
<circle className="flow-dot dot-a" cx="48" cy="180" r="7" /> <circle className="flow-dot dot-a" data-motion-dot cx="48" cy="180" r="7" />
<circle className="flow-dot dot-b" cx="260" cy="180" r="9" /> <circle className="flow-dot dot-b" data-motion-dot cx="260" cy="180" r="9" />
<circle className="flow-dot dot-c" cx="488" cy="154" r="7" /> <circle className="flow-dot dot-c" data-motion-dot cx="488" cy="154" r="7" />
</g> </g>
<rect className="node node-a" x="72" y="58" width="128" height="68" rx="18" /> <rect className="node node-a" data-motion="node" x="72" y="58" width="128" height="68" rx="18" />
<rect className="node node-b" x="242" y="146" width="140" height="76" rx="20" /> <rect className="node node-b" data-motion="node" x="242" y="146" width="140" height="76" rx="20" />
<rect className="node node-c" x="352" y="248" width="120" height="62" rx="17" /> <rect className="node node-c" data-motion="node" x="352" y="248" width="120" height="62" rx="17" />
</svg> </svg>
); );
} }
function HeroConsole() { function HeroConsole() {
return ( return (
<div className="hero-console" aria-label="BossAI 路由状态预览"> <div className="hero-console" data-motion="hero-console" aria-label="BossAI 路由状态预览">
<div className="console-orbit" /> <div className="console-orbit" data-motion-orbit />
<div className="console-bar"> <div className="console-bar">
<span>Unified Gateway</span> <span>Unified Gateway</span>
<strong>路由在线</strong> <strong>路由在线</strong>
</div> </div>
<div className="route-list"> <div className="route-list">
{routes.map((route) => ( {routes.map((route) => (
<div className="route-row" data-tone={route.tone} key={route.type}> <div className="route-row" data-motion="route-row" data-tone={route.tone} key={route.type}>
<span>{route.type}</span> <span>{route.type}</span>
<strong>{route.model}</strong> <strong>{route.model}</strong>
<em>{route.state}</em> <em>{route.state}</em>
@@ -119,9 +132,10 @@ function HeroConsole() {
export default function Home() { export default function Home() {
return ( return (
<BossAiMotion>
<main className="site-shell"> <main className="site-shell">
<div className="site-noise" aria-hidden="true" /> <div className="site-noise" aria-hidden="true" />
<header className="site-nav"> <header className="site-nav" data-motion="nav">
<Link className="brand-mark" href="/" aria-label="BossAI 首页"> <Link className="brand-mark" href="/" aria-label="BossAI 首页">
<Image src="/logo.png" width={38} height={38} alt="" priority /> <Image src="/logo.png" width={38} height={38} alt="" priority />
<span>BossAI</span> <span>BossAI</span>
@@ -143,7 +157,7 @@ export default function Home() {
</header> </header>
<section className="hero-section"> <section className="hero-section">
<div className="hero-copy"> <div className="hero-copy" data-motion="hero-copy">
<div className="section-kicker"> <div className="section-kicker">
<span className="pulse-dot" /> <span className="pulse-dot" />
多模型 · 多模态 · 工作流 多模型 · 多模态 · 工作流
@@ -167,14 +181,19 @@ export default function Home() {
<HeroConsole /> <HeroConsole />
</section> </section>
<section id="platform" className="platform-section"> <section id="platform" className="platform-section" data-motion="section">
<div className="section-heading"> <div className="section-heading">
<span>Platform</span> <span>Platform</span>
<h2>一套后台,接住 API、工作流和创作应用</h2> <h2>一套后台,接住 API、工作流和创作应用</h2>
</div> </div>
<div className="capability-grid"> <div className="capability-grid">
{platformItems.map((item, index) => ( {platformItems.map((item, index) => (
<article className="capability-card" key={item.title} style={{ ["--index" as string]: index }}> <article
className="capability-card"
data-motion="card"
key={item.title}
style={{ ["--index" as string]: index }}
>
<div className="card-top"> <div className="card-top">
<span>{item.eyebrow}</span> <span>{item.eyebrow}</span>
<strong>{item.metric}</strong> <strong>{item.metric}</strong>
@@ -186,7 +205,7 @@ export default function Home() {
</div> </div>
</section> </section>
<section id="workflow" className="workflow-section"> <section id="workflow" className="workflow-section" data-motion="section">
<div className="workflow-panel"> <div className="workflow-panel">
<div className="section-heading"> <div className="section-heading">
<span>Workflow</span> <span>Workflow</span>
@@ -197,7 +216,7 @@ export default function Home() {
</p> </p>
<div className="mode-list"> <div className="mode-list">
{workflowModes.map(([key, label]) => ( {workflowModes.map(([key, label]) => (
<div key={key}> <div data-motion="card" key={key}>
<code>{key}</code> <code>{key}</code>
<span>{label}</span> <span>{label}</span>
</div> </div>
@@ -205,30 +224,30 @@ export default function Home() {
</div> </div>
</div> </div>
<div className="node-board" aria-label="工作流节点预览"> <div className="node-board" aria-label="工作流节点预览">
<div className="node-card wide"> <div className="node-card wide" data-motion="card">
<span>Prompt</span> <span>Prompt</span>
<strong>文案、角色、镜头、商品信息</strong> <strong>文案、角色、镜头、商品信息</strong>
</div> </div>
<div className="node-card"> <div className="node-card" data-motion="card">
<span>Image</span> <span>Image</span>
<strong>生图</strong> <strong>生图</strong>
</div> </div>
<div className="node-card"> <div className="node-card" data-motion="card">
<span>Video</span> <span>Video</span>
<strong>视频</strong> <strong>视频</strong>
</div> </div>
<div className="node-card"> <div className="node-card" data-motion="card">
<span>Voice</span> <span>Voice</span>
<strong>TTS</strong> <strong>TTS</strong>
</div> </div>
<div className="node-card"> <div className="node-card" data-motion="card">
<span>Archive</span> <span>Archive</span>
<strong>工作空间</strong> <strong>工作空间</strong>
</div> </div>
</div> </div>
</section> </section>
<section id="factory" className="factory-section"> <section id="factory" className="factory-section" data-motion="section">
<div className="factory-copy"> <div className="factory-copy">
<span>Creation OS</span> <span>Creation OS</span>
<h2>从提示词到短视频,从素材到数字人</h2> <h2>从提示词到短视频,从素材到数字人</h2>
@@ -238,12 +257,14 @@ export default function Home() {
</div> </div>
<div className="module-strip"> <div className="module-strip">
{productionModules.map((module) => ( {productionModules.map((module) => (
<span key={module}>{module}</span> <span data-motion="card" key={module}>
{module}
</span>
))} ))}
</div> </div>
</section> </section>
<section id="deploy" className="deploy-section"> <section id="deploy" className="deploy-section" data-motion="section">
<div> <div>
<span>Deploy</span> <span>Deploy</span>
<h2>远程模型优先,本机不必有 GPU</h2> <h2>远程模型优先,本机不必有 GPU</h2>
@@ -252,22 +273,22 @@ export default function Home() {
</p> </p>
</div> </div>
<div className="deploy-stack"> <div className="deploy-stack">
<div> <div data-motion="card">
<small>Backend</small> <small>Backend</small>
<strong>Rust 二进制</strong> <strong>Rust 二进制</strong>
</div> </div>
<div> <div data-motion="card">
<small>Database</small> <small>Database</small>
<strong>SQLite / PostgreSQL</strong> <strong>SQLite / PostgreSQL</strong>
</div> </div>
<div> <div data-motion="card">
<small>Website</small> <small>Website</small>
<strong>Next.js 独立部署</strong> <strong>Next.js 独立部署</strong>
</div> </div>
</div> </div>
</section> </section>
<section className="final-section"> <section className="final-section" data-motion="section">
<h2>把模型、工作流和创作应用收进一个平台</h2> <h2>把模型、工作流和创作应用收进一个平台</h2>
<p>适合自建 AI 中转、团队模型管理、多模态创作和商业化用户面板。</p> <p>适合自建 AI 中转、团队模型管理、多模态创作和商业化用户面板。</p>
<div className="hero-actions"> <div className="hero-actions">
@@ -280,5 +301,6 @@ export default function Home() {
</div> </div>
</section> </section>
</main> </main>
</BossAiMotion>
); );
} }
+18
View File
@@ -8,6 +8,8 @@
"name": "bossai-website", "name": "bossai-website",
"version": "0.1.0", "version": "0.1.0",
"dependencies": { "dependencies": {
"@gsap/react": "^2.1.2",
"gsap": "^3.15.0",
"next": "16.2.7", "next": "16.2.7",
"react": "19.2.7", "react": "19.2.7",
"react-dom": "19.2.7" "react-dom": "19.2.7"
@@ -47,6 +49,16 @@
"tslib": "^2.4.0" "tslib": "^2.4.0"
} }
}, },
"node_modules/@gsap/react": {
"version": "2.1.2",
"resolved": "https://registry.npmmirror.com/@gsap/react/-/react-2.1.2.tgz",
"integrity": "sha512-JqliybO1837UcgH2hVOM4VO+38APk3ECNrsuSM4MuXp+rbf+/2IG2K1YJiqfTcXQHH7XlA0m3ykniFYstfq0Iw==",
"license": "SEE LICENSE AT https://gsap.com/standard-license",
"peerDependencies": {
"gsap": "^3.12.5",
"react": ">=17"
}
},
"node_modules/@img/colour": { "node_modules/@img/colour": {
"version": "1.1.0", "version": "1.1.0",
"resolved": "https://registry.npmmirror.com/@img/colour/-/colour-1.1.0.tgz", "resolved": "https://registry.npmmirror.com/@img/colour/-/colour-1.1.0.tgz",
@@ -1221,6 +1233,12 @@
"dev": true, "dev": true,
"license": "ISC" "license": "ISC"
}, },
"node_modules/gsap": {
"version": "3.15.0",
"resolved": "https://registry.npmmirror.com/gsap/-/gsap-3.15.0.tgz",
"integrity": "sha512-dMW4CWBTUK1AEEDeZc1g4xpPGIrSf9fJF960qbTZmN/QwZIWY5wgliS6JWl9/25fpTGJrMRtSjGtOmPnfjZB+A==",
"license": "Standard 'no charge' license: https://gsap.com/standard-license."
},
"node_modules/jiti": { "node_modules/jiti": {
"version": "2.7.0", "version": "2.7.0",
"resolved": "https://registry.npmmirror.com/jiti/-/jiti-2.7.0.tgz", "resolved": "https://registry.npmmirror.com/jiti/-/jiti-2.7.0.tgz",
+2
View File
@@ -10,6 +10,8 @@
"typecheck": "tsc --noEmit" "typecheck": "tsc --noEmit"
}, },
"dependencies": { "dependencies": {
"@gsap/react": "^2.1.2",
"gsap": "^3.15.0",
"next": "16.2.7", "next": "16.2.7",
"react": "19.2.7", "react": "19.2.7",
"react-dom": "19.2.7" "react-dom": "19.2.7"