加载中…
创作者 · Aceternity UI
查看原始来源 ↗
Prompt
// components/ui/container-text-flip.tsx
"use client";
import React, { useState, useEffect, useId } from "react";
import { motion } from "motion/react";
import { cn } from "@/utils/cn";
export interface ContainerTextFlipProps {
/** 动画中循环切换的单词数组 */
words?: string[];
/** 单词切换之间的时间,单位为毫秒 */
interval?: number;
/** 应用于容器的额外 CSS 类 */
className?: string;
/** 应用于文本的额外 CSS 类 */
textClassName?: string;
/** 过渡动画的持续时间,单位为毫秒 */
animationDuration?: number;
}
export function ContainerTextFlip({
words = ["更好", "现代", "美观", "出色"],
interval = 3000,
className,
textClassName,
animationDuration = 700,
}: ContainerTextFlipProps) {
const id = useId();
const [currentWordIndex, setCurrentWordIndex] = useState(0);
const [width, setWidth] = useState(100);
const textRef = React.useRef(null);
const updateWidthForWord = () => {
if (textRef.current) {
// 为文本宽度添加一些内边距(每侧 30px)
// @ts-ignore
const textWidth = textRef.current.scrollWidth + 30;
setWidth(textWidth);
}
};
useEffect(() => {
// 每当单词变化时更新宽度
updateWidthForWord();
}, [currentWordIndex]);
useEffect(() => {
const intervalId = setInterval(() => {
setCurrentWordIndex((prevIndex) => (prevIndex + 1) % words.length);
// 宽度将在依赖 currentWordIndex 的 effect 中更新
}, interval);
return () => clearInterval(intervalId);
}, [words, interval]);
return (
<motion.p
layout
layoutId={`words-here-${id}`}
animate={{ width }}
transition={{ duration: animationDuration / 2000 }}
className={cn(
"relative inline-block rounded-lg pt-2 pb-3 text-center text-4xl font-bold text-black md:text-7xl dark:text-white",
"[background:linear-gradient(to_bottom,#f3f4f6,#e5e7eb)]",
"shadow-[inset_0_-1px_#d1d5db,inset_0_0_0_1px_#d1d5db,_0_4px_8px_#d1d5db]",
"dark:[background:linear-gradient(to_bottom,#374151,#1f2937)]",
"dark:shadow-[inset_0_-1px_#10171e,inset_0_0_0_1px_hsla(205,89%,46%,.24),_0_4px_8px_#00000052]",
className,
)}
key={words[currentWordIndex]}
>
<motion.div
transition={{
duration: animationDuration / 1000,
ease: "easeInOut",
}}
className={cn("inline-block", textClassName)}
ref={textRef}
layoutId={`word-div-${words[currentWordIndex]}-${id}`}
>
<motion.div className="inline-block">
{words[currentWordIndex].split("").map((letter, index) => (
<motion.span
key={index}
initial={{
opacity: 0,
filter: "blur(10px)",
}}
animate={{
opacity: 1,
filter: "blur(0px)",
}}
transition={{
delay: index * 0.02,
}}
>
{letter}
</motion.span>
))}
</motion.div>
</motion.div>
</motion.p>
);
}适用模型与稳定度
建议模型
继续探索
@Oluwaphilemon1 使用 Claude Fable 5 · Three.js · Blender · GSAP完成的网页案例,包含公开结果、完整 Prompt 与原始来源。
提示语
Claude Fable 5 和 GPT-5.6 很强🥵🥵🥵 下面是我如何使用 Claude 构建的 👇 提示词:「设计一个机构网站,把服务以 3D 超市商品包装的形式呈现」 使用 Three.js 和 WebGL 在浏览器中实时渲染所有产品 使用 Blender 制作包装模型,然后导出为 GLTF 以加载到 Three.js 中 使用 GSAP 实现流畅的产品旋转和悬停交互 如果你想做一个让客户感觉像是在购买高级商品的作品集,请保存这条 🛒
复制这段 TSX 组件源码,交给 Cursor、v0、Claude 等 AI 编程工具,说明这是「3D Animated Pin」的 Aceternity UI 组件实现,即可让它接入你的 React 项目,再按需替换文案、配色与触发参数复用。
提示语
// components/ui/3d-pin.tsx "use client"; import React, { useState } from "react"; import { motion } from "motion/react"; import { cn } from "@/lib/utils"; export const PinContainer = ({ children, title, href, className, containerClassName…

提示语
首先搜索 "/unlazy" skill,完整阅读它,并在整个任务中持续使用。 将此视为一项至少持续 {argument name="minimum duration" default="5 小时"} 的大型视觉构建。如果环境允许,最好进行 {argument name="optimal duration" default="8–24 小时"} 有实质意义的实现和迭代。不要在制作出一个还不错的场景后就停下。 在浏览器中创建一个细节极其丰富的实时 {argument nam