Communitygithub.com

Andersonlimahw/lemon-ai-hub

运动令牌、弹簧预设和 React/Next.js (motion/react) 交互模式,用于构建出现在视频中的产品 UI —— 忠实重建真实产品界面,将其动画化为可搜索的场景,并保持实际产品的运动与影片一致。适用于运动视频展示或重建产品 UI 的场景;若无视频交付的纯 Web UI 工作,请改用 design-expert。

lemon-ai-hub 是什么?

该技能为开发者提供了一套完整的 UI 运动模式系统,特别适合需要同时支持实时的 Web 产品 UI 和视频中产品界面重建的场景。它首先强调“令牌优先”的设计思路,通过定义统一的 motion 令牌(如持续时间、缓动曲线、距离和弹簧预设)来确保所有动画行为一致,并避免组件中出现内联数值。对于无障碍和低端设备,技能提供了 `useSafeMotion` 钩子,利用 `useReducedMotion` 检测用户的运动偏好,在减少运动时仅保留短暂的透明度变化。在页面模式方面,它列举了按钮按下、条件渲染、页面过渡、列表交错、重排/缩放、模态框、提示、数字变化、滚动揭示和加载成功等十多种常见交互模式,并为每种模式规定了明确的实现规则。针对产品 UI 的视频重建,技能强调“测量而非猜测”,建议从设计源获取真实令牌,采用“截图背景 + 动态元素覆盖”的混合方案,并严格禁止未经批准重新设计。视频中所有动画值需基于绝对时间驱动,以确保场景可搜素。该技能支持 motion/react、GSAP 和闭环弹簧等多种动画引擎,适用于 React 和 Next.js 项目。

兼容平台~Claude Code~Codex CLI~Cursor
npx skills add https://github.com/Andersonlimahw/lemon-ai-hub/tree/HEAD/plugins/motion-movie-expert/skills/ui-motion-patterns

在你喜欢的 AI 中提问

打开一个已预加载此 Agent Skill 的新对话。

文档

UI 运动模式

两项任务:在网页上为产品 UI 添加动画,以及在视频中重建产品 UI 而不重新设计。两者使用相同的令牌。

1. 令牌优先

一次定义运动,随处导入。组件中不出现内联数值。

// lib/motion-tokens.ts
export const motionTokens = {
  duration: { instant: 0.1, fast: 0.18, normal: 0.3, slow: 0.5, scene: 0.7 },
  easing: {
    standard: [0.2, 0, 0, 1],   // 进入 + 移动
    exit: [0.4, 0, 1, 1],       // 离开
    emphasized: [0.3, 0, 0, 1],
  },
  distance: { nudge: 4, small: 8, medium: 16, large: 32 },
  stagger: 0.06,                // 保持介于 0.05 和 0.10 之间
} as const;

export const springs = {
  press:   { type: "spring", stiffness: 600, damping: 38 },  // 按钮、开关
  snappy:  { type: "spring", stiffness: 420, damping: 34 },  // 标签、菜单
  gentle:  { type: "spring", stiffness: 260, damping: 27 },  // 卡片、面板
  layout:  { type: "spring", stiffness: 320, damping: 30 },  // 重排、调整大小
  camera:  { type: "spring", stiffness: 140, damping: 20 },  // 大幅度移动,仅用于视频
} as const;

质量为 1 时,阻尼比 ζ = damping / (2·√stiffness):press 0.78,snappy 0.83,gentle 0.84,layout 0.84,camera 0.85 —— 全部落在 0.75–0.90 范围内(过冲 ≤ ~6%)。可按照该公式根据品牌进行调整,并始终将该表格作为唯一来源。

2. 无障碍与 SSR

"use client";
import { useReducedMotion } from "motion/react";

export function useSafeMotion() {
  const reduce = useReducedMotion();
  return {
    reduce,
    // 减少运动:去掉变换,保持短的透明度变化(≤0.2 s)
    enter: reduce ? { opacity: 1 } : { opacity: 1, y: 0 },
    initial: reduce ? { opacity: 0 } : { opacity: 0, y: 8 },
    transition: reduce ? { duration: 0.2 } : undefined,
  };
}
  • 对首次绘制时已可见的元素使用 initial={false},以避免水合闪烁。
  • 仅对 transform 和 opacity 做动画。切勿在循环中对 width、height、top、left 或 box-shadow 做动画;改用 layout 或 scale。
  • 低端设备:缩短持续时间并跳过装饰性动画。

3. 模式及其规则

模式规则
按钮按下whileTap={{ scale: 0.96 }} 配合 springs.press;在 100 毫秒内提供反馈
条件渲染用 AnimatePresence 包裹并赋予稳定的 key;每个 initial + animate 都需对应一个 exit
页面 / 路由过渡AnimatePresence mode="wait":退出动画完成后才进入
列表交错staggerChildren 0.05–0.10 秒;交错项上限约为 8 个,其余同时出现
重排 / 调整大小仅在小子树(≲5 个子元素)上使用 layout;否则使用显式 x/y
模态框 / 底部弹出焦点陷阱、Escape 关闭、滚动锁定、role="dialog"、aria-modal="true"、焦点返回
提示从所在边缘进入;自动消失,悬停/聚焦时暂停
数字变化垂直滚动:旧值向上退出并带模糊,新值从下方进入;font-variant-numeric: tabular-nums
滚动揭示whileInView 配合 viewport={{ once: true }};滚动离开时从不重新动画
加载 → 成功按钮压缩 → 旋转动画 → 对勾;保持按钮宽度稳定

4. 重建用于视频的产品 UI

  • 测量而非猜测。 从产品源码或计算样式中获取令牌:颜色、圆角、字体族/字重/字间距、间距、图标集和描边。从真实截图中采样颜色并进行比较。
  • 混合默认方案。 使用真实截图作为背景;仅重建那些会动画的元素,并在其上实现像素级对齐。
  • 未经明确批准绝不重新设计。 不使用新的颜色、字体、图标或文案。
  • 抓取干净内容。 使用登出账户或演示账户、虚构数据、不包含个人身份信息、除非用户拥有否则不包含第三方品牌。
  • 可搜索。 在视频中,每个动画值都基于绝对时间驱动(value = f(t)),而不是来自 motion/react 的运行状态。motion/react 用于实时网页,闭环弹簧或 GSAP 时间轴用于渲染视频。

当这些模式用于网站而非视频时,在上线之前需通过 design-expert 验证关卡(键盘、焦点、减少运动、性能)。

Individual skills in this repo

This repo contains 9 individual skills — each has its own dedicated page.

Andersonlimahw/lemon-ai-hub

When the user wants to plan a product launch, feature announcement, or release strategy. Also use when the user mentions 'launch,' 'Product Hunt,' 'feature release,' 'announcement,' 'go-to-market,' 'beta launch,' 'early access,' 'waitlist,' 'product update,' 'how do I launch this,' 'launch checklist,' 'GTM plan,' or 'we're about to ship.' Use this whenever someone is preparing to release something publicly. For ongoing marketing after launch, see marketing-ideas. For the offer being launched (bonuses, guarantees, scarcity, naming), see offers.

Andersonlimahw/lemon-ai-hub

Create and edit motion videos end to end — product motion films, motion graphics, narrated explainers, captioned clips, UI animation recreations, and recuts. Orchestrates brief, storyboard, choreography, build (HyperFrames or any deterministic renderer), voice/caption sync, and render QC. Use when the user asks to make, animate, storyboard, narrate, caption, edit, or render a video or motion piece; skip for static images and web UI work with no video deliverable.

Andersonlimahw/lemon-ai-hub

Build and render a deterministic video composition — HyperFrames (HTML + GSAP) by default, or a custom seek(t) + Playwright + FFmpeg pipeline. Covers project setup, composition contract, timeline rules, creative direction for frames, lint/check/snapshot, preview, and local render. Use when implementing an approved storyboard as code.

Andersonlimahw/lemon-ai-hub

Motion law for multi-scene videos — seam continuity (axis, direction, speed, phase), carriers, causal motion, springs and timing, camera, transitions, stillness, and loop design. Use when planning or fixing how scenes connect and move, before and during any animation build.

Andersonlimahw/lemon-ai-hub

Short design-led motion graphics where motion is the message — kinetic typography, stat count-up, chart/data-viz reveal, logo sting, lower third or callout, animated map, tweet/news/headline card, webpage or UI walkthrough, and image-plus-data fusion. Usually under 10 s, up to about 30 s, no narration; renders to MP4 or a transparent overlay. Use when the user wants a short motion graphic, animated stat/chart/logo/map/card, or overlay; when the upstream HyperFrames `motion-graphics` skill is installed, use it for exact CLI flags and registry blocks.

Andersonlimahw/lemon-ai-hub

Turn a video idea, product, or script into an approved master prompt and pre-implementation storyboard — intake, concept, 8–12 state sequence, beat grid, transition map, camera plan, audio cue plan, and render architecture. Use before building any new video, or when a video brief is vague.

Andersonlimahw/lemon-ai-hub

Edit existing video and verify any render before delivery — recut, trim, reframe to other aspect ratios, burn in or attach captions, swap or remix audio, loop, and export; plus the QC gates (probe, contact sheet, stills per beat, loudness, loop seam, legibility, facts, PII). Use for editing footage or for the final check of any motion video.

Andersonlimahw/lemon-ai-hub

Synchronize narration, captions, music, and SFX with picture — narration writing, script lock, TTS or recorded voiceover, word-level timestamps, caption blocks, shot windows derived from the voice track, dwell budgets, ducking, and loudness targets. Use for narrated explainers, voiceover changes, subtitles, or any video where timing must follow audio.

Andersonlimahw/lemon-ai-hub

Agent skill at plugins/video/SKILL.md

相关技能