Shape Landing Hero — 動態幾何形狀英雄元件
英雄區塊取自 MIT 授權的
pulkitxm/claude-directory展示區。
整合了 Kokonut UI 的 HeroGeometric 元件——五個模糊的漸層形狀,在近乎黑色的 #030303 背景上,以 Framer Motion 驅動,漂浮在漸層遮罩的標題後方。該元件被放置於標準的 shadcn/ui 專案結構中,並包覆在一個完整的著陸體驗中(浮動導覽列、行動呼籲按鈕、即時屬性展示區、功能網格、安裝區塊),使其在摺頁上方呈現。這個動畫英雄區塊是深色主題 SaaS、設計工具或作品集著陸頁面的理想起點。
工作流程
- 將
example.html複製到使用者的工作區作為工作檔案。 - 取代佔位內容,替換為使用者的真實品牌名稱、標題、內文、數字和圖像。更換素材時請比對現有圖像尺寸。
- 保留設計系統。 下方建置規格中的調色盤、字體比例、間距韻律和動態效果即為其識別——請勿替換字型、重新著色或移除裝飾性元素。
- 透過複製區塊來擴充,切勿從其他範本匯入版面。如果缺少某個區塊,請使用此範本的語彙從頭設計。
- 保持動畫的無障礙性。 如同建置規格的要求,每個動畫都必須遵守
prefers-reduced-motion。
輸出規範
在 <artifact> 標籤之間輸出:
<artifact identifier="shape-landing-hero" type="text/html" title="Shape Landing Hero — 動態幾何形狀英雄元件">
<!doctype html>
<html>...</html>
</artifact>
建置規格
以下是產生此設計的上游提示,一字不差。
整合元件
你接獲一項任務,要將現有的 React 元件整合到程式碼庫中
程式碼庫應支援:
- SHADCN 專案結構
- TAILWIND CSS
- TYPESCRIPT
若未支援,請提供如何透過 shadcn CLI 設定專案、安裝 Tailwind 或 TypeScript 的說明。
確定元件和樣式的預設路徑。
如果元件的預設路徑不是 /components/ui,請說明為何需要建立此資料夾
將此元件複製貼上到 /components/ui 資料夾:
shape-landing-hero.tsx
"use client";
import { motion, useMotionValue, useTransform, animate } from "framer-motion";
import { Circle } from "lucide-react";
import { useEffect, useState } from "react";
import { cn } from "@/lib/utils";
function ElegantShape({
className,
delay = 0,
width = 400,
height = 100,
rotate = 0,
gradient = "from-white/[0.08]",
}: {
className?: string;
delay?: number;
width?: number;
height?: number;
rotate?: number;
gradient?: string;
}) {
return (
<motion.div
initial={{
opacity: 0,
y: -150,
rotate: rotate - 15,
}}
animate={{
opacity: 1,
y: 0,
rotate: rotate,
}}
transition={{
duration: 2.4,
delay,
ease: [0.23, 0.86, 0.39, 0.96],
opacity: { duration: 1.2 },
}}
className={cn("absolute", className)}
>
<motion.div
animate={{
y: [0, 15, 0],
}}
transition={{
duration: 12,
repeat: Number.POSITIVE_INFINITY,
ease: "easeInOut",
}}
style={{
width,
height,
}}
className="relative"
>
<div
className={cn(
"absolute inset-0 rounded-full",
"bg-gradient-to-r to-transparent",
gradient,
"backdrop-blur-[2px] border-2 border-white/[0.15]",
"shadow-[0_8px_32px_0_rgba(255,255,255,0.1)]",
"after:absolute after:inset-0 after:rounded-full",
"after:bg-[radial-gradient(circle_at_50%_50%,rgba(255,255,255,0.2),transparent_70%)]"
)}
/>
</motion.div>
</motion.div>
);
}
function HeroGeometric({
badge = "Design Collective",
title1 = "Elevate Your Digital Vision",
title2 = "Crafting Exceptional Websites",
}: {
badge?: string;
title1?: string;
title2?: string;
}) {
const fadeUpVariants = {
hidden: { opacity: 0, y: 30 },
visible: (i: number) => ({
opacity: 1,
y: 0,
transition: {
duration: 1,
delay: 0.5 + i * 0.2,
ease: [0.25, 0.4, 0.25, 1],
},
}),
};
return (
<div className="relative min-h-screen w-full flex items-center justify-center overflow-hidden bg-[#030303]">
<div className="absolute inset-0 bg-gradient-to-br from-indigo-500/[0.05] via-transparent to-rose-500/[0.05] blur-3xl" />
<div className="absolute inset-0 overflow-hidden">
<ElegantShape
delay={0.3}
width={600}
height={140}
rotate={12}
gradient="from-indigo-500/[0.15]"
className="left-[-10%] md:left-[-5%] top-[15%] md:top-[20%]"
/>
<ElegantShape
delay={0.5}
width={500}
height={120}
rotate={-15}
gradient="from-rose-500/[0.15]"
className="right-[-5%] md:right-[0%] top-[70%] md:top-[75%]"
/>
<ElegantShape
delay={0.4}
width={300}
height={80}
rotate={-8}
gradient="from-violet-500/[0.15]"
className="left-[5%] md:left-[10%] bottom-[5%] md:bottom-[10%]"
/>
<ElegantShape
delay={0.6}
width={200}
height={60}
rotate={20}
gradient="from-amber-500/[0.15]"
className="right-[15%] md:right-[20%] top-[10%] md:top-[15%]"
/>
<ElegantShape
delay={0.7}
width={150}
height={40}
rotate={-25}
gradient="from-cyan-500/[0.15]"
className="left-[20%] md:left-[25%] top-[5%] md:top-[10%]"
/>
</div>
<div className="relative z-10 container mx-auto px-4 md:px-6">
<div className="max-w-3xl mx-auto text-center">
<motion.div
custom={0}
variants={fadeUpVariants}
initial="hidden"
animate="visible"
className="inline-flex items-center gap-2 px-3 py-1 rounded-full bg-white/[0.03] border border-white/[0.08] mb-8 md:mb-12"
>
<Circle className="h-2 w-2 fill-rose-500/80" />
<span className="text-sm text-white/60 tracking-wide">
{badge}
</span>
</motion.div>
<motion.div
custom={1}
variants={fadeUpVariants}
initial="hidden"
animate="visible"
>
<h1 className="text-4xl sm:text-6xl md:text-8xl font-bold mb-6 md:mb-8 tracking-tight">
<span className="bg-clip-text text-transparent bg-gradient-to-b from-white to-white/80">
{title1}
</span>
<br />
<span
className={cn(
"bg-clip-text text-transparent bg-gradient-to-r from-indigo-300 via-white/90 to-rose-300 "
)}
>
{title2}
</span>
</h1>
</motion.div>
<motion.div
custom={2}
variants={fadeUpVariants}
initial="hidden"
animate="visible"
>
<p className="text-base sm:text-lg md:text-xl text-white/40 mb-8 leading-relaxed font-light tracking-wide max-w-xl mx-auto px-4">
Crafting exceptional digital experiences through
innovative design and cutting-edge technology.
</p>
</motion.div>
</div>
</div>
<div className="absolute inset-0 bg-gradient-to-t from-[#030303] via-transparent to-[#030303]/80 pointer-events-none" />
</div>
);
}
export { HeroGeometric }
demo.tsx
import { HeroGeometric } from "@/components/ui/shape-landing-hero"
function DemoHeroGeometric() {
return <HeroGeometric badge="Kokonut UI"
title1 = "Elevate Your"
title2 = "Digital Vision" />
}
export { DemoHeroGeometric }
安裝 NPM 依賴套件:
lucide-react, framer-motion
實作指南
- 分析元件結構並找出所有必要的依賴套件
- 檢視元件的引數和狀態
- 找出任何必要的 Context Provider 或 Hook 並安裝它們
- 需釐清的問題
- 這個元件會接收到哪些資料/屬性?
- 是否有特定的狀態管理需求?
- 是否需要任何資產(圖片、圖示等)?
- 預期的響應式行為為何?
- 在應用程式中使用此元件的最佳位置為何?
整合步驟
- 將上述所有程式碼複製貼上到正確的目錄
- 安裝外部依賴套件
- 使用你知道存在的 Unsplash 素材圖片填補圖片資產
- 如果元件需要,使用 lucide-react 圖示來處理 SVG 或標誌
來源與授權
取自 MIT 授權的
pulkitxm/claude-directory。
上游的 MIT 授權條款文字已隨附在此範本的 LICENSE 中,且
在轉發 example.html 或 assets/ 的任何副本時,必須一併重新散布。
網頁字型與全解析度圖像並未隨附:本機的 @font-face
規則是從 Google Fonts CDN 提供服務,而引用的圖像已被
縮小。請取得上游資料夾以取得原始資產。