Communitygithub.com

地图路线动画

使用 three.js 制作 1080x1920 竖屏 3D 地图路线动画,适用于短视频。包含白色 3D 城市、自绘路线、弹跳红色终点标记、实时倒计时 ETA 卡片和目的地卡片。

地图路线动画 是什么?

该技能通过 three.js 和 headless Chrome 生成高质量的 3D 地图路线动画视频(竖屏 1080x1920)。它首先接收用户提供的起点到终点、行程时间和距离等信息,然后根据 spec schema 构建 JSON 配置文件。技能会自动生成包含白色 3D 城市建筑、公园、河流的城市模型,路线以用户指定的强调色动态绘制,同时摄像机沿路线移动并在动画结束时拉远视角。终点处会显示一个弹跳的红色大头针,并配合实时倒计时 ETA 卡片和目的地卡片来增强交互感。技能支持 WebGL 渲染、快照预览和视觉质量检查(确保卡片不重叠)。 支持的平台包括任何能够执行 Python 脚本、Node.js 和 headless Chrome 的环境(如 Claude Code),使用 ffmpeg 进行视频编码。高级用户还可以通过修改 waypoint 和模板文件自定义路线形状。

兼容平台✓Claude Code~Codex CLI~Cursor
npx skills add https://github.com/hieubm1707/gemini-animation-skills/tree/HEAD/skills/map-route

在你喜欢的 AI 中提问

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

文档

3D 地图路线(map-route)

┌──────────────────────┐
│ [▲ 9 分钟]           │  ETA 卡片倒计时,然后显示“已到达”
│      ┌Iron Yard Gym┐ │  大头针落下后显示目的地卡片
│  ▒▒   ▒▒   📍  ▒▒    │  白色 3D 建筑、公园、河流
│  ▒▒ ━━━━━━━┛   ▒▒    │  路线自绘,摄像机沿路移动
│  ▒▒ ┃  ▒▒      ▒▒    │  最后镜头拉远
└──────────────────────┘

环境检查

SKILL_DIR 是此 SKILL.md 文件所在的目录(请检查 <skills> 中的路径)。

SKILL_DIR="$(python3 -c 'import os,sys; print(os.path.realpath(sys.argv[1]))' "<包含此 SKILL.md 的目录>")"
KIT="$(python3 -c 'import os,sys; print(os.path.realpath(os.path.join(sys.argv[1], "..", "..", "kit")))' "$SKILL_DIR")"
[ -s "$KIT/node_modules/three/build/three.module.js" ] || bash "$KIT/setup.sh"

需要 ffmpeg、node(18+)、python3(3.9+)以及通过 headless Chrome 支持的 WebGL。

步骤

  1. 收集行程详情。 获取目的地名称、行程时间(minutes)和 distance(例如“家到健身房,2.8 公里,9 分钟”)。如果只提供了时间或距离之一,则估算另一个(步行约 12 分钟/公里,骑行约 4 分钟/公里,城市驾车约 2 分钟/公里)并告知用户。
  2. 编写规范文件。 使用以下 schema 创建 <name>.map.json。
  3. 验证并快速截图。
    python3 "$SKILL_DIR/build.py" <name>.map.json --check
    python3 "$SKILL_DIR/build.py" <name>.map.json --snap 3.8
    
    使用 read_file 检查截图 PNG,然后再进行完整的 3D 渲染。
  4. 渲染。 运行:
    python3 "$SKILL_DIR/build.py" <name>.map.json
    
    大约需要 1.5 分钟(headless Chrome 中的 WebGL;HyperFrames 报出 sub_timeline_readiness_timeout 警告是正常的)。
  5. 视觉质量检查(必需)。 使用 read_file 检查 <name>.map.sheet.jpg:
    • 目的地卡片完全位于红色安全区域框内,无裁剪。
    • 街道/地点标签不遮挡 ETA 卡片或目的地卡片。
  6. 交付。 返回可点击的 .mp4 和 .sheet.jpg 链接。

规范 Schema

{
  "destination": "Iron Yard Gym",
  "minutes": 9,
  "distance": 2.8,
  "unit": "km",
  "places": ["北码头", "植物园", "市场大厅", "榆树公园", "运河"],
  "accent": "#2f7cf6",
  "seed": 7
}
  • destination、minutes、distance(必需)。destination 长度不超过约 26 个字符。
  • unit:"km" 或 "mi"。
  • places:5 个短灰色标签,位于固定地图位置:[起点附近,左侧公园,路线中间街区,右侧公园,河流]。可以使用本地化名称或 "" 来隐藏某个标签。
  • accent:6 位十六进制颜色,用于路线、移动点和 ETA 图标。大头针保持红色。
  • seed:任意整数;改变建筑和公园布局。
  • hold(可选):末尾额外停留的秒数。
  • out(可选):自定义输出的 .mp4 路径。

自定义路线形状(高级)

默认路径为向上、向右、向上、向右。要更改它,请将 "$SKILL_DIR/template.html" 复制到规范文件旁边,在规范中添加 "template": "template.html",然后编辑 WP([x, z] 路径控制点,位于街道网格的 4 的倍数上;x 在 -36..36 范围内,z 在 -88..24 范围内,向北为 -z)。更新最终的镜头拉远目标(new THREE.Vector3(3, 0, -27))和 LBL 位置以匹配,然后使用 --snap 3.8 验证。

品味规则

  • 使用简短、真实的地点名称;目的地卡片舒适容纳约 26 个字符。
  • 保持简洁:一条路线、一个红色大头针,无额外箭头或标注。

Individual skills in this repo

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

breakdown

Makes a 3D exploded-view vertical animation (1080x1920) for a reel using three.js. A phone floats on a dark studio backdrop, separates layer by layer (glass, OLED screen, frame, logic board, battery, back), and draws thin leader lines to numbered labels. Use when the user asks for /breakdown, an exploded view, a "what's inside" teardown, or a labelled 3D hardware breakdown.

graph

Makes a minimal vertical (1080x1920) line-graph animation for a reel. A smooth black line draws itself on white (or white on black) while one large number counts up with the tip and lands on the final value. Use when the user asks for /graph, a growth chart, a "0 to 100K" number counter, an animated stat, or a minimal metric line chart.

low-poly

Makes a PS1/N64-era retro low-poly 3D vertical animation (1080x1920) for a reel using three.js. Chunky low-res nearest-neighbour pixels, vertex snapping, dithering, warm flat lighting, and small yellow captions with a thin black outline. Built-in scene: a dog waits on a station platform while a train arrives and leaves, and seasons turn to snow. Use when the user asks for /low-poly, PS1-style, N64 retro 3D, or "low poly shorts" animations.

minimalistic-graphics

Makes a minimal black-and-white line-art vertical animation (1080x1920) for a reel. Thin outlined steps rise one by one, a white dot hops up them, an orbit with sparks draws around the dot at the top, and one quiet lowercase line swaps to a second line. Use when the user asks for /minimalistic-graphics, simple black-and-white motion graphics, calm self-improvement visuals, or line art with one moving dot.

相关技能