Skills2026年3月29日·1 分钟阅读

Remotion Rule: Maps

Remotion skill rule: Make map animations with Mapbox. Part of the official Remotion Agent Skill for programmatic video in React.

Agent 就绪

这个资产会安全暂存

这个资产会先安全暂存。复制的指令会要求 Agent 读取暂存文件,并在激活脚本、MCP 配置或全局配置前先确认。

Stage only · 29/100策略:需暂存
Agent 入口
任意 MCP/CLI Agent
类型
Skill
安装
Stage only
信任
信任等级:Established
入口
Remotion Rule: Maps
安全暂存命令
npx -y tokrepo@latest install acc76203-2142-455f-aa36-a8d6b7a9fa1f --target codex

先暂存文件;激活前需要读取暂存 README 和安装计划。

TL;DR
Remotion Maps rule lets AI agents create animated map sequences using Mapbox in React video.
§01

What it is

Remotion Rule: Maps is a skill rule within the Remotion Agent Skill ecosystem. It provides instructions and patterns for creating animated map visualizations using Mapbox GL inside Remotion, the React-based programmatic video framework. The rule teaches AI coding agents how to render map flyovers, route animations, marker transitions, and geographic data visualizations as video frames.

This rule targets developers and AI agents building data-driven video content that includes geographic visualizations: travel videos, logistics dashboards, real estate tours, or news graphics with map context.

§02

How it saves time or tokens

Without this skill rule, an AI agent would need to figure out the integration between Remotion's frame-based rendering model and Mapbox GL's JavaScript API from scratch. The rule encodes the correct patterns: how to interpolate camera positions across frames, how to render Mapbox tiles at specific zoom levels, and how to synchronize map animations with other video elements. This eliminates trial-and-error prompt cycles.

The rule also documents known pitfalls (tile loading timing, headless rendering constraints) that would otherwise consume debugging time and tokens.

§03

How to use

  1. Install Remotion and the Mapbox GL package: npm install remotion @remotion/player mapbox-gl. Get a Mapbox access token from mapbox.com.
  2. Add the Remotion Maps rule to your AI agent's skill set (e.g., in Claude Code's .claude/rules/ or Cursor rules).
  3. Prompt your AI agent to create a map animation. The rule guides the agent to use the correct Remotion + Mapbox integration patterns.
§04

Example

import { useCurrentFrame, interpolate } from 'remotion';
import mapboxgl from 'mapbox-gl';
import { useEffect, useRef } from 'react';

export const MapFlyover: React.FC = () => {
  const frame = useCurrentFrame();
  const mapRef = useRef<mapboxgl.Map | null>(null);

  const lat = interpolate(frame, [0, 150], [37.7749, 40.7128]);
  const lng = interpolate(frame, [0, 150], [-122.4194, -74.0060]);
  const zoom = interpolate(frame, [0, 75, 150], [12, 5, 12]);

  useEffect(() => {
    if (mapRef.current) {
      mapRef.current.setCenter([lng, lat]);
      mapRef.current.setZoom(zoom);
    }
  }, [frame]);

  return <div id='map' style={{ width: 1920, height: 1080 }} />;
};

This component creates a camera flyover from San Francisco to New York, interpolating latitude, longitude, and zoom across 150 frames.

§05

Related on TokRepo

§06

Common pitfalls

  • Mapbox tiles load asynchronously. In Remotion's rendering pipeline, you must ensure tiles are fully loaded before capturing each frame. Use delayRender and continueRender to handle async tile loading.
  • Mapbox GL requires a valid access token. Free tier includes limited map loads per month. High-frame-count videos can consume map loads quickly.
  • Headless rendering (for video export) requires a WebGL context. Ensure your rendering environment supports GPU-accelerated WebGL or use software rendering fallbacks.

常见问题

What is Remotion?+

Remotion is a React-based framework for creating videos programmatically. You write video scenes as React components, use hooks like useCurrentFrame for animation, and render to MP4 or WebM. It brings the React component model to video production.

Do I need a Mapbox account?+

Yes. Mapbox GL requires an access token for tile loading. Mapbox offers a free tier with a generous number of map loads per month. For video rendering with many frames, monitor your usage to stay within limits.

Can this rule be used with other map providers?+

The rule is designed for Mapbox GL specifically. The patterns (camera interpolation, frame-based rendering) apply conceptually to other map libraries like Leaflet or Google Maps, but the API calls would differ.

How do I export the final video?+

Use Remotion's built-in rendering: npx remotion render src/index.tsx MapFlyover out/map-video.mp4. Remotion renders each frame as an image and encodes them into a video file using FFmpeg.

Can AI agents use this rule automatically?+

Yes. When loaded as a skill rule in Claude Code or Cursor, the AI agent receives the Mapbox + Remotion integration patterns as context. The agent can then generate map animation code that follows the correct patterns without trial and error.

引用来源 (3)
🙏

来源与感谢

Created by Remotion. Licensed under MIT. remotion-dev/skills — Rule: maps

Part of the Remotion AI Skill collection on TokRepo.

讨论

登录后参与讨论。
还没有评论,来写第一条吧。

相关资产