remotion-markup
Content, animation and effects best practices
Install
npx skills add https://github.com/muzimu217/ui-design-agent-kit/tree/main/.agents/skills/remotion-markup
claude plugin marketplace add https://llmmart.ai/marketplace.json && claude plugin install muzimu217-ui-design-agent-kit@llmmart
git clone https://github.com/muzimu217/ui-design-agent-kit.git
The skills CLI installs just this skill, for any of its supported agents. Claude Code installs the whole muzimu217/ui-design-agent-kit collection as a plugin from our marketplace. Git is the plain clone.
Skill manifest
This is guidance for writing Remotion React Markup. If this is not relevant, load Remotion Best Practices instead.
Preserve user changes
Users may make edits in the code outside of the conversation.
If you detect a surprising change made in the meanwhile, don't overwrite it, assume it was intentional or ask for confirmation.
General rules
Drive animations using useCurrentFrame() and interpolate().
CSS transition or animation will not render correctly, they need to refactored.
Tailwind animation class will not render correctly, they need to be refactored.
Use Easing.bezier() and Easing.spring() to customize timing.
Structure your markup according to Remotion Interactivity Best Practices
import { useCurrentFrame, Easing, interpolate, Interactive } from "remotion";
export const FadeIn = () => {
const frame = useCurrentFrame();
return (
<Interactive.Div
name="Title"
style={{
opacity: interpolate(frame, [0, 2 * fps], [0, 1], {
extrapolateRight: "clamp",
extrapolateLeft: "clamp",
easing: Easing.bezier(0.16, 1, 0.3, 1),
}),
}}
>
Hello World!
</Interactive.Div>
);
};
Keep the interpolate() call inline in the style prop.
Use scale, translate, rotate CSS properties over transform.
// 👍 Inline editable keyframes and transform shorthands
style={{
scale: interpolate(frame, [0, 100], [0, 1], {
extrapolateLeft: 'clamp',
extrapolateRight: 'clamp',
easing: Easing.spring({damping: 200}),
output: 'perceptual-scale' // For `scale` animations, use "output: 'perceptual-scale'"
}),
translate: interpolate(frame, [0, 100], ["0px 0px", "100px 100px"], {
extrapolateLeft: 'clamp',
extrapolateRight: 'clamp',
easing: Easing.spring({damping: 200}),
}),
rotate: interpolate(frame, [0, 100], ["20deg", "90deg"], {
extrapolateLeft: 'clamp',
extrapolateRight: 'clamp',
easing: Easing.spring({damping: 200}),
}),
}}
// 👎 Non-inline values and transform strings become harder to edit in Studio
const scale = interpolate(frame, [0, 100], [0, 1]);
style={{
transform: `scale(${scale})`,
}}
Assets
Place assets in the public/ folder at your project root.
Use staticFile() to reference files from the public/ folder.
Media components
Add video and audio using <Video> and <Audio> from @remotion/media.
Add images using the <CanvasImage> component.
Add animated GIFs, APNG, WebP or AVIF images using <AnimatedImage>, use @remotion/gif if not using Chrome.
Use staticFile() for files in public/ or pass a remote URL directly:
import { Audio, Video } from "@remotion/media";
import { staticFile, CanvasImage, AnimatedImage } from "remotion";
export const MyComposition = () => {
return (
<>
<Video src={staticFile("video.mp4")} style={{ opacity: 0.5 }} />
<Audio src={staticFile("audio.mp3")} />
<CanvasImage
src={staticFile("logo.png")}
style={{ width: 100, height: 100 }}
/>
<Video src="https://remotion.media/video.mp4" />
<AnimatedImage src={staticFile('nyancat.gif')} />
</>
);
};
Example scene
import {
AbsoluteFill,
Easing,
Interactive,
interpolate,
useCurrentFrame,
useVideoConfig
} from "remotion";
export const Empty = () => {
const {fps} = useVideoConfig();
const frame = useCurrentFrame();
return (
<AbsoluteFill
name="Scene"
style={{
display: 'flex',
justifyContent: 'center',
alignItems: 'center',
backgroundColor: 'white'
}}
>
<Interactive.Div
name="Title"
style={{
opacity: interpolate(frame, [1 * fps, 2 * fps], [0, 1], {
extrapolateRight: "clamp",
extrapolateLeft: "clamp",
easing: Easing.bezier(0.16, 1, 0.3, 1),
}),
fontSize: 88
}}
>
Title
</Interactive.Div>
<Interactive.Div
name="Subtitle"
style={{
opacity: interpolate(frame, [2 * fps, 3 * fps, 8 * fps, 10 * fps], [0, 1, 1, 0], {
extrapolateRight: "clamp",
extrapolateLeft: "clamp",
easing: [Easing.bezier(0.16, 1, 0.3, 1), Easing.linear, Easing.bezier(0.16, 1, 0.3, 1)],
}),
fontSize: 32
}}
>
Subtitle
</Interactive.Div>
</AbsoluteFill>
);
}
Delaying, trimming
Most components (<AbsoluteFill>, <Interactive.*> <Img>, <AnimatedImage>, <CanvasImage>, <HtmlInCanvas>, <Solid>, <Sequence> from remotion, <Video> and <Audio> from @remotion/media, <Gif>, and more) support the following props:
from
<Img from={1 * fps} {/* ... */}/>
<Video from={1 * fps} {/* ... */}/>
<Interactive.Div from={1 * fps} {/* ... */}/>
When the element starts appearing in the timelien.
durationInFrames
<Img durationInFrames={20 * fps} {/* ... */}/>
<Interactive.Div durationInFrames={20 * fps} {/* ... */}/>
For how long the layer plays in the timeline.
For media, pass the natural duration of the media: <Video durationInFrames={29.322 * fps}/>
trimBefore
Useful for components whose internal clock should start later:
// Trim away first 2 seconds of footage
<Video trimBefore={2 * fps} {/* ... */} />
// `useCurrenFrame()` for children starts at `10 * fps`
<Sequence trimBefore={10 * fps} {/* ... */} />
Fallback
If a component does not support these props, wrap it in<Sequence> from remotion, which has them.
layout="absolute-fill"makes the Sequence behave like AbsoluteFilllayout="none"is "headless" mode, no wrapper element is used.
Maps
See Remotion Maps if wanting to include maps in the video.
Text highlights and annotations
See text-highlights.md for text highlights (highlight markers), circles, underlines, strike-throughs, crossed-off text, boxes.
Multi-scene videos
See multi-scene-video.md if planning to make a video with multiple subsequent scenes.
Voiceover
See voiceover.md for adding an AI-generated voiceover to Remotion compositions using ElevenLabs TTS.
Embedding Videos
See embedding-videos.md for advanced knowledge about embedding videos - trimming, volume, speed, looping, pitch.
Embedding Audio
See audio.md for advanced audio features like trimming, volume, speed, pitch.
Video editing
See video-editing.md for structuring editable video timelines in Remotion Studio.
Cropping
See cropping.md if needing to crop the visible rectangle of a component.
Transitions
See transitions.md for scene transition patterns.
Visual and pixel effects
When creating a visual effect, consider whether it is feasible using CSS and HTML, or whether a shader is needed.
Order or preference:
- Regular HTML + CSS or other web techniques
- An effect applied to the element directly (
<Video>,<Img>), or by wrapping the content in<HtmlInCanvas>, which also acceptseffects:
- A listed effect via effects.md
- A custom
createEffect()via effects.md when no preset is available.
3D content
See ./3d.md for 3D content in Remotion using Three.js and React Three Fiber.
Sound effects
When needing to use sound effects, load the ./sfx.md file for more information.
Audio visualization
When needing to visualize audio (spectrum bars, waveforms, bass-reactive effects), load the ./audio-visualization.md file for more information.
Maps
For static maps, animated routes and markers, geographic explainers, Mapbox, MapLibre, MapTiler, GeoJSON, or 3D geographic flyovers, load Remotion Maps.
Captions
When dealing with captions or subtitles, load the Remotion Captions skill for more information.
Google Fonts
Is the recommended way to load fonts in Remotion. See google-fonts.md for how to load Google Fonts.
Local fonts
See local-fonts.md for how to load local fonts.
GIFs
See gifs.md for how to display GIFs synchronized with Remotion's timeline.
Advanced Images
See images.md for sizing and positioning images, dynamic image paths, and getting image dimensions.
Lottie animations
See lottie.md for embedding Lottie animations in Remotion.
Timing
See timing.md for more timing techniques for interpolate().
Parameterized videos
See parameters.md for making a composition parametrizable by adding a Zod schema.
Measuring DOM nodes
See measuring-dom-nodes.md for measuring DOM element dimensions in Remotion.
Measuring text
See measuring-text.md for measuring text dimensions, fitting text to containers, and checking overflow.
Using FFmpeg
For some video operations, such as trimming videos or detecting silence, FFmpeg should be used. Load the ./ffmpeg.md file for more information.
Silence detection
When needing to detect and trim silent segments from video or audio files, load the ./silence-detection.md file.
Dynamic duration, dimensions and data
See calculate-metadata.md for dynamically set composition duration, dimensions, and props.
Advanced compositions
See compositions.md for how to define stills, folders, default props and for how to nest compositions.
Advanced sequencing
See sequencing.md for more sequencing patterns - delay, trim, limit duration of items.
Install modules
Use npx remotion add to add new packages with the right version:
npx remotion add @remotion/media
This goes for @remotion/* packages, mediabunny, @mediabunny/*, and zod.
Previewing markup
npx remotion studio --no-open
This will start a long-running process and print the server URL for the preview.
If server is already started, it will print the URL.
You can visit a specific composition by navigating to /[composition-id], for example http://localhost:3000/MapAnimation.
Optional: one-frame render check
You can render a single frame with the CLI to sanity-check layout, colors, or timing.
Skip it for trivial edits, pure refactors, or when you already have enough confidence from Studio or prior renders.
npx remotion still [composition-id] --scale=0.25 --frame=30
At 30 fps, --frame=30 is the one-second mark (--frame is zero-based).
Files (ui-design-agent-kit)
-
agents
-
openai.yaml 310 B
interface: display_name: '/remotion-markup' short_description: 'Apply Remotion animation and effects practices' icon_small: './assets/remotion-icon.png' icon_large: './assets/remotion-icon.png' brand_color: '#0B84F3' default_prompt: '$remotion-markup: Apply best Remotion Practices to MyComp.tsx.'
-
-
assets
-
remotion-icon.png 1.3 KB · in bundle
-
-
remotion-maps
-
agents
-
openai.yaml 293 B
interface: display_name: '/remotion-maps' short_description: 'Create animated maps in Remotion videos' icon_small: './assets/remotion-icon.png' icon_large: './assets/remotion-icon.png' brand_color: '#0B84F3' default_prompt: '$remotion-maps: Animate a dot from Zurich to New York.'
-
-
assets
-
remotion-icon.png 1.3 KB · in bundle
-
-
techniques
-
cesium
-
assets
-
cesium-path.json 12 KB
[ [94.986139893537, 29.76417312959953], [94.98637054463002, 29.764163024004816], [94.98661427422437, 29.764153025681516], [94.9868698103708, 29.764142908388347], [94.98713600736019, 29.764132461562934], [94.98741179569139, 29.76412145291623], [94.9876962466277, 29.764109663422126], [94.98798853462426, 29.764096898390772], [94.98828790834106, 29.764082995679242], [94.98859364523021, 29.764067827511347], [94.98890509685035, 29.764051279216236], [94.98922167960325, 29.76403324759024], [94.98954294512464, 29.76401367774424], [94.9898685550894, 29.76399255290906], [94.99019820264337, 29.76396985787546], [94.9905316178847, 29.763945606334815], [94.9908685732739, 29.763919866576575], [94.99120886105722, 29.763892700951896], [94.99155229116181, 29.7638641665054], [94.99189872300363, 29.76383429811986], [94.99224811692223, 29.763803085651237], [94.99260053337049, 29.763770509641105], [94.99295601118384, 29.76373658086857], [94.99331456742908, 29.763701322339223], [94.99367598745215, 29.763664830647013], [94.99404000156176, 29.763627219082974], [94.99440635968021, 29.763588592698778], [94.99477481502787, 29.76354905236459], [94.9951451006731, 29.763508748648892], [94.99578766204738, 29.763462125646818], [94.99643710580968, 29.763412119743368], [94.99709296623192, 29.763358988682928], [94.99775479298779, 29.763302979031952], [94.99842214521965, 29.763244327404465], [94.99909470569231, 29.763183258547627], [94.9997722961385, 29.76312010454948], [95.00045474013422, 29.763055184243758], [95.00114189582168, 29.762988795623112], [95.00183368970049, 29.762921207778405], [95.0025300799095, 29.76285270023514], [95.00323103443773, 29.762783549665084], [95.00393658318124, 29.76271400155497], [95.00464681949704, 29.76264432424487], [95.00536183331896, 29.76257477740286], [95.00608171146906, 29.762505612813378], [95.00680653793428, 29.762437075077955], [95.00753639864557, 29.762369398844733], [95.00827137837749, 29.762302811854063], [95.00901153006761, 29.762237519590354], [95.00975680776318, 29.76217368790719], [95.01050716875933, 29.762111478518566], [95.0112626067996, 29.76205102042169], [95.01202312290016, 29.761992432502932], [95.01278871942189, 29.76193583156792], [95.01355940108247, 29.761881333165324], [95.01433525277555, 29.761829093407865], [95.01511636205572, 29.761779224166457], [95.01590278872715, 29.76173180995877], [95.0166868810408, 29.76168612055982], [95.01746871725406, 29.761642332250204], [95.0182483756254, 29.76160062131038], [95.01902596675926, 29.761561177619345], [95.019801682618, 29.761524238306453], [95.02057570378254, 29.76149004865798], [95.02134818878243, 29.761458838563573], [95.02211921065114, 29.761430763930672], [95.02288888930805, 29.761405973069504], [95.02365734467304, 29.761384614290225], [95.02442469666667, 29.761366835902948], [95.02519095257038, 29.761352731197437], [95.02595602043016, 29.761342344990513], [95.02671980829304, 29.761335722099044], [95.02748221022355, 29.76133286485609], [95.02824308111781, 29.761333684556867], [95.02900227020879, 29.761338090875398], [95.02975960629327, 29.76134599002589], [95.03051480114966, 29.76135728786741], [95.03126749207338, 29.761371921751238], [95.03201723576402, 29.761389829130785], [95.03276363398774, 29.761410893146387], [95.03350632277824, 29.761434973117545], [95.03424521675927, 29.76146183394706], [95.03498037607913, 29.761491215377145], [95.035711917426, 29.761522866578012], [95.03643998610582, 29.761556530192124], [95.03716475930274, 29.761591886465347], [95.03788653744915, 29.761628566185358], [95.03860571883365, 29.76166618469001], [95.03932258585421, 29.76170436456548], [95.04003738892985, 29.76174273062808], [95.04075025083816, 29.76178094997509], [95.0414610559133, 29.76181870813213], [95.04216961904287, 29.761855638407084], [95.04287591713418, 29.761891331889718], [95.04357986124926, 29.761925397709096], [95.04428137757625, 29.761957488479126], [95.04498041854592, 29.76198725048925], [95.04567682817188, 29.762014317811357], [95.04637032968634, 29.762038376323694], [95.04706059416637, 29.762059099770216], [95.04774726432963, 29.762076162373777], [95.0484300050609, 29.762089241174117], [95.04910871445378, 29.762098042845082], [95.04978328153793, 29.762102280852183], [95.05045359964508, 29.76210167552205], [95.05111966253706, 29.76209602004179], [95.05178153406797, 29.762085106891018], [95.05243927503516, 29.762068731547185], [95.05309287649075, 29.762046750046103], [95.0537422946664, 29.762019099359485], [95.05438748396233, 29.761985721609257], [95.05502839823626, 29.76194655859307], [95.05566488201883, 29.761901557942874], [95.05629656919591, 29.761850805510885], [95.05692313234233, 29.761794428680094], [95.0575442743842, 29.761732580860688], [95.0581596433054, 29.761665348138973], [95.05876888708963, 29.761592816601354], [95.05937164047754, 29.761515065256333], [95.05996759228947, 29.761432144038746], [95.06055643134583, 29.761344102883623], [95.06113793491645, 29.761251010034922], [95.06171214230999, 29.761153046649387], [95.06227907948092, 29.761050389948267], [95.06283877238438, 29.760943217152814], [95.06339127381165, 29.760831691663462], [95.06393669678933, 29.760716002374487], [95.06447520396281, 29.76059636241658], [95.06500695797821, 29.760472984920362], [95.06553212847378, 29.760346104258282], [95.0660508986937, 29.760216015040477], [95.06656344194985, 29.760083025494016], [95.06707002648291, 29.75994741412334], [95.06757112978441, 29.759809440866206], [95.06806722979658, 29.759669344181514], [95.06855878142073, 29.759527354008487], [95.06904617625263, 29.759383697903765], [95.06952978875404, 29.75923861533451], [95.07000993080214, 29.759092371156385], [95.07048679175114, 29.758945227682446], [95.07096044787545, 29.75879742836973], [95.07143096114058, 29.758649219939148], [95.0718984144853, 29.758500858117706], [95.07236278188816, 29.7583525823887], [95.07282412506945, 29.758204644682806], [95.07328275575983, 29.75805728963777], [95.07373905641253, 29.757910760813612], [95.07419366476313, 29.757765217208473], [95.07464735762416, 29.757620800921966], [95.07510085345471, 29.757477677507868], [95.07555467766437, 29.757336168750566], [95.07600940811365, 29.757196598118206], [95.07646537399586, 29.75705931280275], [95.0769228207089, 29.756924677394206], [95.07738220221682, 29.756793075496777], [95.07784401968648, 29.75666487927172], [95.07830874492939, 29.756540496044202], [95.07877690647402, 29.756420332181715], [95.07924898851259, 29.75630478841808], [95.07972503722137, 29.756194196891926], [95.08020511490892, 29.756088882533362], [95.0806891403115, 29.75598918720403], [95.08117690920173, 29.75589531641115], [95.08166835685006, 29.755807414283098], [95.08216335868525, 29.75572566824862], [95.08266177736347, 29.755650250535062], [95.08316349491537, 29.75558120546187], [95.08366839703267, 29.755518567048284], [95.08417639041532, 29.75546236367944], [95.08468755179344, 29.755412571989652], [95.08520236790308, 29.755369015997044], [95.08572134650697, 29.75533148313236], [95.0862450098908, 29.755299740305322], [95.08677390781156, 29.75527358808779], [95.08730861289804, 29.755252808551163], [95.08784970300886, 29.755237175354623], [95.08839755885471, 29.755226476280296], [95.08895256438073, 29.755220494902016], [95.089514993805, 29.755219019351184], [95.09008489086116, 29.7552217729881], [95.09066229928165, 29.75522847917293], [95.09124726342738, 29.755238870403907], [95.09183976966378, 29.755252726598844], [95.09243978867215, 29.75526985018834], [95.09304723439128, 29.755290065097345], [95.09366184648091, 29.75531326126932], [95.09428337414857, 29.755339326723966], [95.09491171647382, 29.755368102171502], [95.09554680939114, 29.75539940595205], [95.09618846028675, 29.755433126230766], [95.09683632409143, 29.75546923335011], [95.09749004228215, 29.75550775219342], [95.09814924669702, 29.755548754655436], [95.0988136358514, 29.755592374644042], [95.09948290826172, 29.755638746066982], [95.1001568080277, 29.75568798494813], [95.10083517891061, 29.75574017449467], [95.10151797539464, 29.75579531974171], [95.1022051519645, 29.755853425724286], [95.10289664375364, 29.755914488290983], [95.10359258928374, 29.755978570204803], [95.10429306658138, 29.756045742645284], [95.10499798654989, 29.756116067070348], [95.10570717321444, 29.75618958016383], [95.10642032295875, 29.75626636089044], [95.10713711848761, 29.756346492746122], [95.10785729025027, 29.75643004436662], [95.10858043622838, 29.75651688160893], [95.10930611534633, 29.75660684892344], [95.11003407093642, 29.756699686157475], [95.11076414467685, 29.756795123665622], [95.1114960914754, 29.756892893838618], [95.11222971288655, 29.756992700238396], [95.1129649452222, 29.75709420093414], [95.11370170201873, 29.75719709582746], [95.11443986012442, 29.757301125099488], [95.11517935555177, 29.7574061249826], [95.11592009761476, 29.757511940391662], [95.11666232015585, 29.75761835330566], [95.11740624233691, 29.757725222810585], [95.11815181076378, 29.75783253698326], [95.11889913308254, 29.757940178669305], [95.11964841222917, 29.758048000558695], [95.12039993276164, 29.758155854652614], [95.12115399312397, 29.75826357999786], [95.1219108497459, 29.75837102690515], [95.1226706293697, 29.758478081829693], [95.12343325561484, 29.758584686897258], [95.12419857627997, 29.758690818430438], [95.12496638982559, 29.75879646083105], [95.12573649209446, 29.7589015818837], [95.12650863318528, 29.75900618637391], [95.12728253192327, 29.759110282431784], [95.12805798566751, 29.75921386162033], [95.12883477913662, 29.759316919371038], [95.12961273528985, 29.759419445656786], [95.13039166301432, 29.759521458216526], [95.13117134363408, 29.759622963323043], [95.13195155721434, 29.759723948972997], [95.13273211930314, 29.759824349786275], [95.13351286507051, 29.759924061406032], [95.13428648274362, 29.76002351015658], [95.1350533298064, 29.760122544307915], [95.1358137532818, 29.760221010686855], [95.13656784419986, 29.760318809952974], [95.13731567503761, 29.76041584848236], [95.1380573752464, 29.760511990985425], [95.13879310931623, 29.76060704815151], [95.13952306473344, 29.760700794123938], [95.14024751710419, 29.7607929520901], [95.14096671686433, 29.760883206230545], [95.14168092332761, 29.76097123202995], [95.14239029599311, 29.761056732470486], [95.14309486625548, 29.761139484506582], [95.14379454089128, 29.761219462160696], [95.14448922306659, 29.76129664046317], [95.14517882147311, 29.76137100941381], [95.14586312132259, 29.761442532574584], [95.14654188135431, 29.761511168945386], [95.14721489938523, 29.761576901934955], [95.14788204807155, 29.761639772673718], [95.14854319868547, 29.76169982923195], [95.14919822095698, 29.761757127412878], [95.14984699116548, 29.76181173598209], [95.15048960377052, 29.761863851723042], [95.15112617637942, 29.761913696049017], [95.15175681293137, 29.761961561816054], [95.15238148064795, 29.762007691856205], [95.15300009096235, 29.762052309028526], [95.1533539374323, 29.762086082676035], [95.15370650809008, 29.762118928860186], [95.15405759583123, 29.762150875711065], [95.15440704121897, 29.76218191319173], [95.1547548321985, 29.762211967913583], [95.15510097264206, 29.762240955288657], [95.15544525415498, 29.762268829619945], [95.15578751039571, 29.76229553455492], [95.15612769998111, 29.762320941845203], [95.15646565712565, 29.762344985615734], [95.156801142589, 29.76236761294652], [95.1571338046714, 29.76238883654028], [95.15746323934037, 29.76240869370805], [95.15778903282519, 29.762427217766984], [95.15811077257146, 29.762444433666733], [95.15842800577592, 29.762460368791256], [95.15874028837707, 29.76247502889767], [95.15904716834646, 29.76248842410003], [95.1593481499996, 29.762500590502704], [95.15964271930007, 29.76251153961251], [95.1599303416933, 29.76252129267978], [95.16021045104225, 29.762529892932115], [95.16048243037355, 29.762537389252305], [95.16074559672008, 29.762543832974302], [95.1609993202866, 29.762549265122786], [95.16124294069552, 29.762553753099137], [95.16147571071544, 29.762557390653928], [95.16169677155058, 29.762560323342807] ] -
CesiumFlythrough.tsx 8.7 KB · in bundle
-
city-path.json 223 B
[ [-74.0135, 40.7047], [-74.0102, 40.7104], [-74.0074, 40.7167], [-74.0047, 40.7232], [-74.0017, 40.7297], [-73.9988, 40.7362], [-73.9954, 40.7429], [-73.9917, 40.7496], [-73.9882, 40.7563], [-73.9848, 40.7631] ] -
example-Root.tsx 923 B · in bundle
-
flight-path.ts 1.2 KB
export type LngLat = [number, number]; // Chaikin corner cutting turns a sparse route into a continuous curve. Repeated passes round // direction changes into deliberate swerves instead of left-right heading bumps. export const smoothFlightPath = (source: LngLat[], passes = 3): LngLat[] => { if (source.length < 2) throw new Error('Flyover path needs at least two points'); // Keep adjacent longitudes continuous for routes that cross the antimeridian. const unwrapped: LngLat[] = [source[0]]; for (let index = 1; index < source.length; index++) { const [lng, lat] = source[index]; const previous = unwrapped[index - 1][0]; let adjusted = lng; while (adjusted - previous > 180) adjusted -= 360; while (adjusted - previous < -180) adjusted += 360; unwrapped.push([adjusted, lat]); } let curve = unwrapped; for (let pass = 0; pass < Math.max(0, passes); pass++) { const next: LngLat[] = [curve[0]]; for (let i = 0; i < curve.length - 1; i++) { const a = curve[i]; const b = curve[i + 1]; next.push( [a[0] * 0.75 + b[0] * 0.25, a[1] * 0.75 + b[1] * 0.25], [a[0] * 0.25 + b[0] * 0.75, a[1] * 0.25 + b[1] * 0.75], ); } next.push(curve[curve.length - 1]); curve = next; } return curve; }; -
sample-river.geojson 6.3 KB · in bundle
-
-
references
-
3d-data-sources.md 1.4 KB
# Flyover data sources ## Landscape Use MapTiler for both layers: - `terrain-quantized-mesh-v2`: elevation encoded as Cesium quantized-mesh terrain. - `satellite-v2`: raster satellite imagery draped on that mesh. CesiumJS renders the layers; it does not supply the data. Set `REMOTION_MAPTILER_KEY`. Create a key: - https://cloud.maptiler.com/account/keys/ Official documentation: - https://docs.maptiler.com/cesium/ - https://docs.maptiler.com/schema-raster/terrain-3d/ ## City Use Google Photorealistic 3D Tiles. Google supplies one high-resolution 3D mesh already textured with imagery. Disable the Cesium globe and do not add MapTiler terrain or satellite beneath it. Set `REMOTION_GOOGLE_MAPS_API_KEY`. Create and configure a key: - https://developers.google.com/maps/documentation/tile/get-api-key Enable the Map Tiles API in a billing-enabled Google Cloud project and restrict the key to that API. The application restriction must permit the local headless Remotion request. Official documentation: - https://developers.google.com/maps/documentation/tile/3d-tiles - https://developers.google.com/maps/documentation/tile/policies ## Why not extruded buildings OSM-, Overture- and vector-tile building products primarily provide footprints, approximate heights and optional roof attributes. They are useful for analytical or stylized maps, but they do not provide the textured architecture required for a cinematic city flyover. -
3d-flyover-architecture.md 7.7 KB
# 3D Flyover — architecture reference Deep detail behind `TECHNIQUE.md`: provider loading, the camera-path pipeline, per-frame camera math, and the proven terrain values. Both landscape and city modes have been forward-tested through Remotion. ## 1. Provider initialization Create the Viewer with `baseLayer: false`, UI widgets disabled, and `contextOptions.webgl.preserveDrawingBuffer: true`. Never hide the credit display. ### Landscape Add MapTiler `satellite-v2` with `UrlTemplateImageryProvider`, then load `terrain-quantized-mesh-v2` with `CesiumTerrainProvider.fromUrl({requestVertexNormals: true})`. MapTiler supplies both datasets; no Cesium ion token is required. ### City Do not add MapTiler. Hide the globe, then add: ```ts viewer.scene.globe.show = false; const tileset = await Cesium.Cesium3DTileset.fromUrl( `https://tile.googleapis.com/v1/3dtiles/root.json?key=${GOOGLE_KEY}`, {showCreditsOnScreen: true, maximumScreenSpaceError: 4}, ); viewer.scene.primitives.add(tileset); ``` Lower `maximumScreenSpaceError` improves refinement at substantial download/render cost. Start at `4` for a hero landmark and `6–8` for wider urban shots. Enforce the Google 30-second promotional video ceiling in the component. Load Cesium from the CDN after setting `window.CESIUM_BASE_URL`; the tested version is `1.143`. ## 2. The camera path — structure & generation Four properties matter, in order: 1. **Continuous curvature** — the camera must flow through curves, never "fly straight, snap to a new heading, fly straight." The component applies three passes of **Chaikin corner cutting** to every supplied path. Each pass replaces a segment with quarter and three-quarter points, rounding a corner into a curve. Three passes are the default; four is softer, two is tighter. 2. **Constant ground speed** — precompute cumulative distance along the rounded curve and interpolate by arc length. Do not animate by source-point index; unequal source spacing creates speed bumps. 3. **Minimized amplitude** — for detailed landscape centerlines, dampen the prepared path toward its straight start→end chord by a fixed fraction `DAMP` (0 = dead straight, 1 = full river). This is the single swerve-amplitude knob. 4. **Enough length** — `PATHKM ≥ TRAVEL_KM + 2·LOOK_AHEAD_KM` so the look-ahead aim never clamps. `../scripts/prep-cesium-path.mjs` does: clip a window of the source centerline → resample to even arc-length spacing (0.1 km) → moving-average smooth (±2.8 km window, 2 passes) → dampen toward the chord (`DAMP=0.45`). Validate with the heading-delta probe it prints — deltas should be small and change _gradually_ (water-wars: `3,0,-1,-3,-4,1,7,9,5,-5,-12,-7,…`). Big jumps = corners = bad. The component then applies Chaikin smoothing to this prepared route, or directly to a short hand-authored city route. Keep city control points sparse and intentional; smoothing cannot rescue a zig-zagging route that crosses the subject repeatedly. **Source data:** OSM via Overpass (~0.3 km vertex spacing) — Natural Earth is too coarse for inner gorges. overpass-api.de is often busy → mirror `overpass.kumi.systems`. ## 3. Camera animation per frame (position, heading, pitch, bank) Walk the path by **arc length** (precompute cumulative distances once). Every frame: - **Position** = the point at `dCam` km along the path, altitude `lerp(ALT_START, ALT_END, prog)`. - **Heading** = bearing from the camera point to a **real point `LOOK_AHEAD_KM` further along the same path**. A far aim averages wiggle → smooth heading; on a curved path it leads into the bend, so the heading turns gently with the path. (A local-tangent aim spins the camera at every kink — don't.) - **Pitch** = constant. We keep a MapLibre-style param `PITCH_FROM_NADIR` (90 = horizon), then convert: **Cesium pitch = `-(90 - PITCH_FROM_NADIR)`** (Cesium: 0 = horizon, -90 = straight down). 76° → -14°. - **Bank (roll)** = lean _into_ the turn — the helicopter tell. Measure turn rate as the bearing change between `aim` and a point `2·LOOK_AHEAD_KM` ahead; `roll = clamp(dH · BANK_GAIN, ±MAX_BANK)`. Because the path is smooth, `dH` changes gradually → the bank eases in and out, never jerks. ```ts const setCamera = (C, viewer, prog) => { const dCam = Math.min(TRAVEL_KM, PATHKM - LOOK_AHEAD_KM * 2) * prog; const cam = alongPath(dCam); // arc-length point const aim = alongPath(dCam + LOOK_AHEAD_KM); // heading target (real point on the path) const aim2 = alongPath(dCam + LOOK_AHEAD_KM * 2); // turn-rate probe → bank const heading = bearing(cam, aim); let dH = bearing(aim, aim2) - heading; while (dH > Math.PI) dH -= 2*Math.PI; while (dH < -Math.PI) dH += 2*Math.PI; viewer.camera.setView({ destination: C.Cartesian3.fromDegrees(cam[0], cam[1], lerp(ALT_START, ALT_END, prog)), orientation: { heading, pitch: C.Math.toRadians(-(90 - PITCH_FROM_NADIR)), roll: clamp(dH * BANK_GAIN, -MAX_BANK, MAX_BANK) }, }); }; ``` > **Cesium vs MapLibre conventions (gotcha):** Cesium heading is radians, 0 = north, clockwise. Pitch > 0 = horizon, negative = down (MapLibre is the inverse). Roll positive = bank right; tune the sign by eye. ## 4. The feel — proven water-wars values | Param | Value | Meaning | | ------------------------ | ---------------------- | ------------------------------------------------------------------------------------ | | `TRAVEL_KM` | 13 | How far the camera travels. **Speed = `TRAVEL_KM / durationSeconds`.** | | duration | 24 s (720 f @30) | 13 km / 24 s ≈ **0.54 km/s** — a slow, peaceful glide. 8 s felt "extremely rushed". | | `ALT_START → ALT_END` | 4600 → 4300 m ASL | Absolute (terrain-independent). Inside the corridor walls → fly _through_, not over. | | `LOOK_AHEAD_KM` | 1.5 | Heading smoothness vs responsiveness. | | `PITCH_FROM_NADIR` | 76° | Stare-ahead down the corridor (90 = level). → Cesium -14°. | | `MAX_BANK` / `BANK_GAIN` | 0.13 rad (~7.5°) / 0.6 | Helicopter lean into turns. | | `verticalExaggeration` | 1.1 | Subtle terrain drama. | | `DAMP` (prep) | 0.45 | Swerve amount: higher = weavier, lower = straighter. | **A slow camera renders fast.** At 0.54 km/s the camera moves ~18 m/frame, so tiles stay cached and each `settle()` returns almost immediately; the 720-frame render completed in one pass (no chunk-rendering). ## 5. The complete component The full, runnable component is `../assets/CesiumFlythrough.tsx` — read it directly. Its shape: - `loadCesium()` — inject `CESIUM_BASE_URL` + the CDN `Cesium.js`, resolve when loaded. - init effect — build the Viewer (§1), `setCamera(…, 0)`, `await settle(viewer)`, `continueRender`. - `settle(viewer)` — loop `viewer.render()` until `globe.tilesLoaded` for landscapes or `tileset.tilesLoaded` for cities is stable for ~8 ticks (cap ~600). - per-frame effect — `delayRender({timeoutInMilliseconds: 60000})` → `setCamera(prog)` → `settle()` → `continueRender`. ## 6. Render ```bash bunx remotion still src/index.ts <Comp> out.png --frame=N --gl=angle --timeout=180000 # validate framing/bank first bunx remotion render src/index.ts <Comp> out.mp4 --gl=angle --concurrency=1 --timeout=180000 ``` `--gl=angle` is mandatory. Use `--concurrency=1`; `settle()` already serializes tile loading. -
3d-troubleshooting.md 6.6 KB
# 3D Flyover — troubleshooting ## The headless dead-end (why we render through Remotion) Cesium's globe **will not draw in a standalone headless Playwright/Chromium** harness. Verified on Apple M4 (ANGLE Metal active, WebGL working): the skybox/stars render, but the globe surface produces **zero draw commands** (`scene.frameState.commandList.length === 0`), `globe.tilesLoaded` never goes true, and frames come back as the black starfield. No network failures; `sampleTerrainMostDetailed` succeeds (terrain data is reachable). Dead-ends tried, all failed: - default render loop, manual `scene.render()`, manual `viewer.render()`, headed mode (context-destroyed). **What works:** render Cesium **through Remotion** — same headless Chrome, but driven by Remotion's frame loop with these four non-negotiables: 1. `useDefaultRenderLoop = false` — drive frames by hand. 2. Per frame call **`viewer.render()`**, NOT `scene.render()`. `viewer.render()` does the full frame (`initializeFrame` → tile streaming → render); `scene.render()` skips frame-init, so tiles never advance and the globe never appears. **This is the single most important line.** 3. `contextOptions: { webgl: { preserveDrawingBuffer: true } }` so Remotion's screenshot captures pixels. 4. Gate init + every frame with `delayRender(…, {timeoutInMilliseconds})` — tile loading can exceed Remotion's default; use 60–120 s. The standalone `flythrough.html` / `render.mjs` / `probe.mjs` from the original spike are kept only as the record of this dead-end. The canonical render path is the Remotion component (`../assets/CesiumFlythrough.tsx`). ## Symptom → fix | Symptom | Cause | Fix | | --------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------- | | Frames are black with stars | Globe not drawing (headless Playwright, or `scene.render()` used) | Render through Remotion; use `viewer.render()`; `useDefaultRenderLoop=false`. | | Screenshots blank/transparent | No `preserveDrawingBuffer` | `contextOptions:{ webgl:{ preserveDrawingBuffer:true } }`. | | "delayRender timed out" | Cold tiles exceed the default | `delayRender(…, {timeoutInMilliseconds: 120000})` + `--timeout=180000`. | | Globe is a dark/navy sphere | Imagery layer didn't attach | `baseLayer:false` then `viewer.imageryLayers.addImageryProvider(...)`. | | High-pitch frame shows a void/starfield above the horizon | No atmosphere | `viewer.scene.skyAtmosphere.show = true`. | | 403 on tiles in headless | Domain-locked MapTiler key | Use an **unrestricted** key. | | Google root tileset returns 403 | Map Tiles API disabled, billing absent, wrong key, or application restriction blocks local headless rendering | Enable Map Tiles API and billing; restrict the key to that API while allowing the Remotion request. | | Google scene shows a duplicate/competing surface | MapTiler or the Cesium globe is still enabled | Do not add MapTiler; set `viewer.scene.globe.show=false`. | | Google mesh remains coarse | Screen-space error is too high or the capture starts before refinement | Lower `maximumScreenSpaceError`; settle on `tileset.tilesLoaded`. | | WebGL unavailable / software renderer | Missing GL flag | Render with `--gl=angle`. | | Camera looks at sky / ground, not terrain | Pitch sign / convention | Cesium pitch 0 = horizon, negative = down (inverse of MapLibre); `-(90 - PITCH_FROM_NADIR)`. | | Aim/turn-probe clamps near the end | Path too short | `PATHKM ≥ TRAVEL_KM + 2·LOOK_AHEAD_KM`; raise `WINDOW_KM` in prep. | | Path feels like straight-then-corner | Douglas-Peucker simplification | Use resample → moving-average smooth (see architecture §2), not `turf.simplify`. | | Camera bumps left and right instead of swerving | Sparse route vertices are still being followed as straight segments | Keep `pathSmoothingPasses={3}`; use sparse intentional control points and arc-length movement. | ## Gotchas checklist - **`viewer.render()`, never `scene.render()`** per frame. The single biggest trap. - Cesium loads from **CDN**; set `window.CESIUM_BASE_URL` _before_ injecting the script. - `preserveDrawingBuffer: true` or screenshots are blank. - `delayRender` uses `timeoutInMilliseconds`; set it to at least 60,000. - Terrain: `baseLayer:false`, then add MapTiler imagery. - Google: no MapTiler, hide the globe, retain `showCreditsOnScreen:true`. - Always `skyAtmosphere.show = true`. - Validate the path's heading-delta probe and render one **still** (framing + bank) before the full mp4. - Cesium pitch/roll conventions are inverted vs MapLibre.
-
-
scripts
-
prep-cesium-path.mjs 5.4 KB · in bundle
-
-
TECHNIQUE.md 3.8 KB
# CesiumJS — 3D flyovers in Remotion Instructions for achieving map animations with "flight-simulator" perspective in Remotion. ## Modes | Mode | Data | Use for | | ----------- | ----------------------------------------------------- | ------------------------------------------------------ | | `landscape` | MapTiler `terrain-quantized-mesh-v2` + `satellite-v2` | Mountains, gorges, rivers, coastlines and rural routes | | `city` | Google Photorealistic 3D Tiles | Cities, architecture and recognizable landmarks | Do not use footprint extrusions for city flyovers. They produce crude building blocks rather than textured architecture. ## Credentials For `landscape`, set: ```text REMOTION_MAPTILER_KEY=... ``` Create a MapTiler key at https://cloud.maptiler.com/account/keys/. For `city`, set: ```text REMOTION_GOOGLE_MAPS_API_KEY=... ``` Create a billing-enabled Google Map Tiles API key by following https://developers.google.com/maps/documentation/tile/get-api-key. Enable the **Map Tiles API** and restrict the key to that API. Ensure its application restriction permits local headless Remotion requests. ## Build the flight 1. Copy `assets/CesiumFlythrough.tsx`, a path JSON and `assets/example-Root.tsx` into the Remotion project, or import the component directly. 2. Supply the camera route as `[longitude, latitude][]`. Use only meaningful control points; do not hand-author dozens of tiny corrections. 3. Leave `pathSmoothingPasses={3}` initially. The component applies repeated Chaikin corner cutting, turning straight-then-corner input into a continuous swerve. Increase to `4` for a softer route or reduce to `2` when the camera must follow a tight corridor. 4. Set absolute camera altitudes for the location. City cameras normally fly lower than landscape cameras. 5. Render a middle-frame still before rendering the full video. ```tsx <CesiumFlythrough mode="city" path={cameraPath} pathSmoothingPasses={3} altitudeStart={700} altitudeEnd={500} lookAheadKm={0.7} travelKm={4.5} /> ``` ## Camera behavior Walk the smoothed curve by arc length for constant ground speed. Aim at a real point farther along the curve rather than its next vertex. Derive roll from the change in look-ahead bearing so the camera banks into a turn instead of twitching left and right. For landscape routes, `scripts/prep-cesium-path.mjs` also clips, resamples, smooths and dampens a GeoJSON centerline before the component applies its final curve smoothing. ## Mechanics - Set `viewer.useDefaultRenderLoop = false`. - Call `viewer.render()`, never `scene.render()`, while settling. - Use `preserveDrawingBuffer: true`. - Gate initialization and every frame with `delayRender`. - Drive camera animation from `useCurrentFrame()`; do not use CSS transitions or browser-timed animation. - Settle landscapes on `globe.tilesLoaded` and cities on `tileset.tilesLoaded`. - Keep all provider attribution visible. - Record the source and effective date of custom or disputed geography. - Inspect rendered pixels, not only Studio playback, at every required aspect ratio. - Read `references/3d-flyover-architecture.md` for camera math, `references/3d-data-sources.md` for provider details, and `references/3d-troubleshooting.md` for blank, coarse, unauthorized or timed-out renders. ## Files - `assets/CesiumFlythrough.tsx` — reusable two-mode component. - `assets/flight-path.ts` — dependency-free Chaikin route smoothing. - `assets/example-Root.tsx` — landscape and city compositions. - `assets/cesium-path.json` — sample landscape route. - `assets/city-path.json` — sample city route. - `assets/sample-river.geojson` — sample path-preparation input. - `scripts/prep-cesium-path.mjs` — dependency-free landscape route preparation.
-
-
mapbox
-
references
-
render-stability.md 3.6 KB
# Moving Map Render Stability Read this reference before building a moving 2D MapTiler scene or diagnosing a wavering Remotion render. ## Symptom and cause If basemap detail shimmers or jitters during a pan/zoom, the likely cause is per-frame `map.jumpTo()`. Headless MapTiler capture can resample both vector hillshade and satellite imagery differently frame to frame. Tile retries, easing changes, and label changes do not solve that renderer effect. ## Required pattern: fixed map plate For any 2D pan/zoom: 1. Render the MapTiler canvas once at the largest required zoom in an oversized container. Size it from the camera route and keep each dimension below the browser's reliable WebGL render-buffer limit (commonly 4096 px). Do **not** blindly use 3×: a 1920×1080 composition becomes 5760 px wide and Chromium may silently downsample it, causing visible pixelation during the CSS zoom. 2. Keep the map's camera static. 3. For each frame, calculate the approved target centre/zoom, then move the canvas with CSS `translate` + `scale`. 4. Apply the same transform to every projected HTML overlay. 5. Continue to animate GeoJSON data and paint properties imperatively; only the renderer camera is frozen. Keep pitch and bearing constant. Use a 3D engine such as Cesium for genuine changing pitch/bearing or a terrain flythrough. ```ts const baseZoom = Math.max(start.zoom, end.zoom); const map = new maptilersdk.Map({ container, style, center: end.center, zoom: baseZoom, pitch: end.pitch ?? 0, bearing: end.bearing ?? 0, interactive: false, fadeDuration: 0, canvasContextAttributes: {preserveDrawingBuffer: true}, }); // Per Remotion frame. `camera` is the approved centre/zoom interpolation. const projected = map.project(camera.center); const scale = 2 ** (camera.zoom - baseZoom); const plate = { transform: `translate(${width / 2 - projected.x * scale}px, ${height / 2 - projected.y * scale}px) scale(${scale})`, transformOrigin: "0 0", }; // Convert label projection with exactly the same plate transform. const labelX = labelPoint.x * scale + width / 2 - projected.x * scale; const labelY = labelPoint.y * scale + height / 2 - projected.y * scale; ``` ### Plate sizing and sharpness - Render at the maximum zoom reached by **any** camera waypoint, including intermediate or hold cameras. The CSS scale should never exceed `1`; otherwise the plate is being enlarged. - Centre the frozen map on the midpoint of the camera route's geographic extent, not automatically on the final camera. This minimizes required overscan. - Keep the largest canvas dimension at or below 4096 px unless the actual render environment has been tested with a larger `MAX_RENDERBUFFER_SIZE`. - For 1920×1080, a 3840×2160 plate is a safe default. For 1080×1920, use approximately 2700×3840 when the route needs extra horizontal pan room. - If the route cannot fit within that plate at the required zoom, split the shot into two fixed plates with a deliberate editorial transition. Do not trade sharpness for one enormous canvas. - Distinguish failure modes: repeating shimmer means the live renderer is moving; steadily soft tiles during a CSS push means the fixed plate is underspecified, internally downsampled, or being scaled above `1`. ## Verification - Render a short MP4, not only a Studio preview. - Inspect static terrain texture and satellite detail while the camera moves. - If any underlying map detail wavers, use the fixed map plate. Do not approve it as a minor preview artefact. - Render WebGL with `--gl=angle`, `preserveDrawingBuffer:true`, and conservative concurrency (`1`) while validating.
-
-
TECHNIQUE.md 12.9 KB
--- name: maps-mapbox description: Make deterministic Remotion 2D map animations with Mapbox GL JS and Turf. Use when the user chooses Mapbox for animated routes, map markers, labels, camera movement, or Mapbox styles. metadata: tags: map, map animation, mapbox, turf, geojson, route animation --- Use Mapbox GL JS for rendering maps in Remotion when the user wants Mapbox styles or higher-fidelity map visuals and has a Mapbox access token. Use Turf for geospatial operations such as great-circle routes, distances, slicing lines, and positions along routes. Use this technique only when the user has a Mapbox access token and wants Mapbox styles or data. ## Core rules - Prefer `@turf/turf` for geospatial work. Do not hand-roll distance, great-circle, route slicing, or coordinate interpolation unless the user explicitly needs a custom non-geodesic effect. - Use GeoJSON sources and Mapbox layers for lines, markers, and labels. Avoid DOM `Marker` elements unless the user specifically asks for HTML markers. - Keep the live map camera static by default. Before moving it on every frame, read [moving-map stability](references/render-stability.md). Prefer a fixed map plate for satellite imagery, hillshade, or a modest 2D reframe. - Use a live per-frame camera only after rendering a short MP4 and checking for shimmer. This 2D technique does not provide genuine terrain, pitch, bearing, or banking. - Disable non-deterministic map behavior: `interactive: false`, `fadeDuration: 0`. - Drive animation from `useCurrentFrame()`; do not use CSS transitions or browser-timed animation. - Use `delayRender()` / `continueRender()` around map loading and per-frame map updates. - Set `preserveDrawingBuffer: true` and render WebGL with `bunx remotion ... --gl=angle`. - Before continuing the initial render, add sources/layers, apply the frame-0 camera with `jumpTo()` or `setFreeCameraOptions()`, then wait for `idle`. - Do not add a `mapInstance.remove()` cleanup function; it can interfere with Remotion's render lifecycle. - Use Mapbox style URLs such as `mapbox://styles/mapbox/standard` or a user-provided custom style. - Do not install `@types/mapbox-gl`; Mapbox GL JS ships its own types. - Keep required provider attribution visible and verify current provider terms before rendering. - Record the source and effective date of custom or disputed geography. - Inspect rendered pixels, not only Studio playback, at every required aspect ratio. Coordinates in Mapbox, Turf, and GeoJSON are `[longitude, latitude]`. ```ts const zurich: [number, number] = [8.5417, 47.3769]; const newYork: [number, number] = [-74.006, 40.7128]; ``` ## Prerequisites Install Mapbox GL JS and Turf with the project's package manager. ```bash npm i mapbox-gl @turf/turf ``` ```bash bun i mapbox-gl @turf/turf ``` ```bash yarn add mapbox-gl @turf/turf ``` ```bash pnpm i mapbox-gl @turf/turf ``` Import the Mapbox CSS once in the component or an app-level stylesheet: ```ts import 'mapbox-gl/dist/mapbox-gl.css'; ``` Mapbox requires a public access token. Prefer passing it as an input prop or reading it from an environment variable that is available to the bundled Remotion code. ```ts const mapboxAccessToken = process.env.REMOTION_MAPBOX_TOKEN; if (!mapboxAccessToken) { throw new Error('Set REMOTION_MAPBOX_TOKEN to render Mapbox maps.'); } ``` ## Basic map example ```tsx import {useEffect, useRef, useState} from 'react'; import {AbsoluteFill, useDelayRender, useVideoConfig} from 'remotion'; import mapboxgl from 'mapbox-gl'; import 'mapbox-gl/dist/mapbox-gl.css'; const zurich: [number, number] = [8.5417, 47.3769]; const mapboxAccessToken = process.env.REMOTION_MAPBOX_TOKEN; if (!mapboxAccessToken) { throw new Error('Set REMOTION_MAPBOX_TOKEN to render Mapbox maps.'); } export const MyComposition = () => { const containerRef = useRef<HTMLDivElement>(null); const {delayRender, continueRender} = useDelayRender(); const {width, height} = useVideoConfig(); const [loadingHandle] = useState(() => delayRender('Loading Mapbox map')); useEffect(() => { if (!containerRef.current) { return; } const mapInstance = new mapboxgl.Map({ accessToken: mapboxAccessToken, container: containerRef.current, style: 'mapbox://styles/mapbox/standard', center: zurich, zoom: 7, interactive: false, attributionControl: false, fadeDuration: 0, canvasContextAttributes: { preserveDrawingBuffer: true, }, }); mapInstance.on('load', () => { mapInstance.jumpTo({center: zurich, zoom: 7}); mapInstance.once('idle', () => { continueRender(loadingHandle); }); }); }, [continueRender, loadingHandle]); return ( <AbsoluteFill> <div ref={containerRef} style={{width, height, position: 'absolute'}} /> </AbsoluteFill> ); }; ``` Animated examples should keep the loaded map in React state and skip per-frame updates until that state is set. ## Animated flight route example This example shows the recommended pattern for route animations: - Turf creates the route and markers. - Turf slices the route for line reveal animation. - Mapbox renders the route with GeoJSON sources and layers. - The camera uses `jumpTo()` with animated center, zoom, bearing, and pitch. - Frame 0 is prepared before `continueRender()`. ```tsx import * as turf from '@turf/turf'; import {useEffect, useRef, useState} from 'react'; import { AbsoluteFill, Easing, interpolate, useCurrentFrame, useDelayRender, useVideoConfig, } from 'remotion'; import mapboxgl, {type GeoJSONSource, type Map} from 'mapbox-gl'; import 'mapbox-gl/dist/mapbox-gl.css'; const zurich: [number, number] = [8.5417, 47.3769]; const newYork: [number, number] = [-74.006, 40.7128]; const mapboxAccessToken = process.env.REMOTION_MAPBOX_TOKEN; if (!mapboxAccessToken) { throw new Error('Set REMOTION_MAPBOX_TOKEN to render Mapbox maps.'); } const greatCircleLine = (from: [number, number], to: [number, number]) => { const route = turf.greatCircle(from, to, {npoints: 100}); if (route.geometry.type === 'LineString') { return turf.lineString(route.geometry.coordinates); } // Great-circle routes crossing the antimeridian can become MultiLineString. // Keep the example valid by choosing the longest segment. const longestSegment = route.geometry.coordinates.reduce((longest, segment) => { return segment.length > longest.length ? segment : longest; }); return turf.lineString(longestSegment); }; const targetRoute = greatCircleLine(zurich, newYork); const targetRouteDistance = turf.length(targetRoute); const cityMarkers = turf.featureCollection([ turf.point(zurich, {name: 'Zurich'}), turf.point(newYork, {name: 'New York'}), ]); const clampProgress = (progress: number) => Math.min(1, Math.max(0, progress)); const distanceAlong = (totalDistance: number, progress: number) => { // Keep the route non-empty at progress 0; Turf can error on zero-length slices. return Math.max(0.001, totalDistance * clampProgress(progress)); }; const getPartialTargetRoute = (progress: number) => { return turf.lineSliceAlong( targetRoute, 0, distanceAlong(targetRouteDistance, progress), ); }; const getCameraOptions = (progress: number) => { const target = turf.along( targetRoute, distanceAlong(targetRouteDistance, progress), ).geometry.coordinates as [number, number]; return { center: target, zoom: interpolate(progress, [0, 0.5, 1], [7, 2.4, 8], { extrapolateLeft: 'clamp', extrapolateRight: 'clamp', easing: Easing.bezier(0.645, 0.045, 0.355, 1), }), bearing: interpolate(progress, [0, 1], [-20, 35], { extrapolateLeft: 'clamp', extrapolateRight: 'clamp', }), pitch: interpolate(progress, [0, 0.25, 0.75, 1], [25, 55, 55, 30], { extrapolateLeft: 'clamp', extrapolateRight: 'clamp', easing: Easing.bezier(0.645, 0.045, 0.355, 1), }), }; }; export const MyComposition = () => { const containerRef = useRef<HTMLDivElement>(null); const frame = useCurrentFrame(); const {delayRender, continueRender} = useDelayRender(); const {durationInFrames, height, width} = useVideoConfig(); const [map, setMap] = useState<Map | null>(null); const [loadingHandle] = useState(() => delayRender('Loading Mapbox map')); useEffect(() => { if (!containerRef.current) { return; } const mapInstance = new mapboxgl.Map({ accessToken: mapboxAccessToken, container: containerRef.current, style: 'mapbox://styles/mapbox/standard', center: zurich, zoom: 7, interactive: false, attributionControl: false, fadeDuration: 0, canvasContextAttributes: { preserveDrawingBuffer: true, }, }); mapInstance.on('load', () => { mapInstance.addSource('trace', { type: 'geojson', data: getPartialTargetRoute(0), }); mapInstance.addLayer({ id: 'trace-line', type: 'line', source: 'trace', layout: { 'line-cap': 'round', 'line-join': 'round', }, paint: { 'line-color': '#111111', 'line-width': 7, }, }); mapInstance.addSource('city-markers', { type: 'geojson', data: cityMarkers, }); mapInstance.addLayer({ id: 'city-marker-dots', type: 'circle', source: 'city-markers', paint: { 'circle-color': '#f03b20', 'circle-radius': 12, 'circle-stroke-color': '#ffffff', 'circle-stroke-width': 4, }, }); mapInstance.addLayer({ id: 'city-marker-labels', type: 'symbol', source: 'city-markers', layout: { 'text-allow-overlap': true, 'text-anchor': 'top', 'text-field': ['get', 'name'], 'text-offset': [0, 0.9], 'text-size': 28, }, paint: { 'text-color': '#111111', 'text-halo-color': '#ffffff', 'text-halo-width': 3, }, }); mapInstance.jumpTo(getCameraOptions(0)); mapInstance.once('idle', () => { setMap(mapInstance); continueRender(loadingHandle); }); }); }, [continueRender, loadingHandle]); useEffect(() => { if (!map) { return; } const handle = delayRender('Rendering Mapbox frame'); const timelineProgress = interpolate(frame, [0, durationInFrames - 1], [0, 1], { extrapolateLeft: 'clamp', extrapolateRight: 'clamp', }); const travelProgress = interpolate(timelineProgress, [0.2, 0.82], [0, 1], { extrapolateLeft: 'clamp', extrapolateRight: 'clamp', easing: Easing.bezier(0.645, 0.045, 0.355, 1), }); const trace = map.getSource('trace') as GeoJSONSource | undefined; trace?.setData(getPartialTargetRoute(travelProgress)); map.jumpTo(getCameraOptions(travelProgress)); map.once('idle', () => continueRender(handle)); // Force an idle event even if the camera parameters are unchanged from the previous frame. map.triggerRepaint(); }, [continueRender, delayRender, durationInFrames, frame, map]); return ( <AbsoluteFill style={{backgroundColor: '#e8eef3'}}> <div ref={containerRef} style={{height, position: 'absolute', width}} /> </AbsoluteFill> ); }; ``` ## Camera guidance For a validated live-camera route animation, animate `center`, `zoom`, `bearing`, and `pitch` with `jumpTo()`: ```ts map.jumpTo({ center, zoom, bearing, pitch, }); ``` Keep route progress and camera progress separate if the camera needs to lead, lag, zoom out, or zoom back in. For cinematic 3D camera moves, load the 3D flyover branch from the parent skill. ## Lines Use GeoJSON sources for lines. Unless the user asks, do not add glow effects or extra decorative points. For geodesic flight routes, use Turf: ```ts const line = greatCircleLine(start, end); const distance = turf.length(line); const partialLine = turf.lineSliceAlong( line, 0, // Keep the route non-empty at progress 0. Math.max(0.001, distance * progress), ); ``` For a visually straight line on the map, use a simple GeoJSON `LineString` between the two points instead of `greatCircle()`. ## Markers and labels Use map-native GeoJSON layers for markers and labels: ```tsx mapInstance.addSource('markers', { type: 'geojson', data: turf.featureCollection([ turf.point([-118.2437, 34.0522], {name: 'Los Angeles'}), ]), }); mapInstance.addLayer({ id: 'marker-dots', type: 'circle', source: 'markers', paint: { 'circle-color': '#f03b20', 'circle-radius': 12, 'circle-stroke-color': '#ffffff', 'circle-stroke-width': 4, }, }); mapInstance.addLayer({ id: 'marker-labels', type: 'symbol', source: 'markers', layout: { 'text-allow-overlap': true, 'text-anchor': 'top', 'text-field': ['get', 'name'], 'text-offset': [0, 0.9], 'text-size': 28, }, paint: { 'text-color': '#111111', 'text-halo-color': '#ffffff', 'text-halo-width': 3, }, }); ``` Make marker sizes and label font sizes large enough for the composition resolution. ## Styles Default to Mapbox Standard: ```ts style: 'mapbox://styles/mapbox/standard' ``` If the user requests another style, use any valid Mapbox style URL. ## Rendering For WebGL map renders, prefer single concurrency and ANGLE: ```bash bunx remotion render [composition-id] out/video.mp4 --gl=angle --concurrency=1 ``` Use the equivalent package runner for the project. In npm projects, use `npx`; in Bun projects, use `bunx`.
-
-
maplibre
-
references
-
render-stability.md 3.6 KB
# Moving Map Render Stability Read this reference before building a moving 2D MapTiler scene or diagnosing a wavering Remotion render. ## Symptom and cause If basemap detail shimmers or jitters during a pan/zoom, the likely cause is per-frame `map.jumpTo()`. Headless MapTiler capture can resample both vector hillshade and satellite imagery differently frame to frame. Tile retries, easing changes, and label changes do not solve that renderer effect. ## Required pattern: fixed map plate For any 2D pan/zoom: 1. Render the MapTiler canvas once at the largest required zoom in an oversized container. Size it from the camera route and keep each dimension below the browser's reliable WebGL render-buffer limit (commonly 4096 px). Do **not** blindly use 3×: a 1920×1080 composition becomes 5760 px wide and Chromium may silently downsample it, causing visible pixelation during the CSS zoom. 2. Keep the map's camera static. 3. For each frame, calculate the approved target centre/zoom, then move the canvas with CSS `translate` + `scale`. 4. Apply the same transform to every projected HTML overlay. 5. Continue to animate GeoJSON data and paint properties imperatively; only the renderer camera is frozen. Keep pitch and bearing constant. Use a 3D engine such as Cesium for genuine changing pitch/bearing or a terrain flythrough. ```ts const baseZoom = Math.max(start.zoom, end.zoom); const map = new maptilersdk.Map({ container, style, center: end.center, zoom: baseZoom, pitch: end.pitch ?? 0, bearing: end.bearing ?? 0, interactive: false, fadeDuration: 0, canvasContextAttributes: {preserveDrawingBuffer: true}, }); // Per Remotion frame. `camera` is the approved centre/zoom interpolation. const projected = map.project(camera.center); const scale = 2 ** (camera.zoom - baseZoom); const plate = { transform: `translate(${width / 2 - projected.x * scale}px, ${height / 2 - projected.y * scale}px) scale(${scale})`, transformOrigin: "0 0", }; // Convert label projection with exactly the same plate transform. const labelX = labelPoint.x * scale + width / 2 - projected.x * scale; const labelY = labelPoint.y * scale + height / 2 - projected.y * scale; ``` ### Plate sizing and sharpness - Render at the maximum zoom reached by **any** camera waypoint, including intermediate or hold cameras. The CSS scale should never exceed `1`; otherwise the plate is being enlarged. - Centre the frozen map on the midpoint of the camera route's geographic extent, not automatically on the final camera. This minimizes required overscan. - Keep the largest canvas dimension at or below 4096 px unless the actual render environment has been tested with a larger `MAX_RENDERBUFFER_SIZE`. - For 1920×1080, a 3840×2160 plate is a safe default. For 1080×1920, use approximately 2700×3840 when the route needs extra horizontal pan room. - If the route cannot fit within that plate at the required zoom, split the shot into two fixed plates with a deliberate editorial transition. Do not trade sharpness for one enormous canvas. - Distinguish failure modes: repeating shimmer means the live renderer is moving; steadily soft tiles during a CSS push means the fixed plate is underspecified, internally downsampled, or being scaled above `1`. ## Verification - Render a short MP4, not only a Studio preview. - Inspect static terrain texture and satellite detail while the camera moves. - If any underlying map detail wavers, use the fixed map plate. Do not approve it as a minor preview artefact. - Render WebGL with `--gl=angle`, `preserveDrawingBuffer:true`, and conservative concurrency (`1`) while validating.
-
-
TECHNIQUE.md 13.1 KB
--- name: maps-maplibre description: Make deterministic Remotion 2D map animations with MapLibre GL JS and Turf. Use when the user chooses MapLibre for animated routes, map markers, labels, and camera movement. metadata: tags: map, map animation, maplibre, turf, geojson, route animation --- Use MapLibre GL JS for rendering maps in Remotion. Use Turf for geospatial operations such as great-circle routes, distances, slicing lines, and positions along routes. ## Core rules - Prefer `@turf/turf` for geospatial work. Do not hand-roll distance, great-circle, route slicing, or coordinate interpolation unless the user explicitly needs a custom non-geodesic effect. - Use GeoJSON sources and MapLibre layers for lines, markers, and labels. Avoid DOM `Marker` elements unless the user specifically asks for HTML markers. - Keep the live map camera static by default. Before moving it on every frame, read [moving-map stability](references/render-stability.md). Prefer a fixed map plate for satellite imagery, hillshade, or a modest 2D reframe. - Use a live per-frame camera only after rendering a short MP4 and checking for shimmer. This 2D technique does not provide genuine terrain, pitch, bearing, or banking. - Disable non-deterministic map behavior: `interactive: false`, `fadeDuration: 0`. - Drive animation from `useCurrentFrame()`; do not use CSS transitions or browser-timed animation. - Use `delayRender()` / `continueRender()` around map loading and per-frame map updates. - Set `preserveDrawingBuffer: true` and render WebGL with `bunx remotion ... --gl=angle`. - Before continuing the initial render, add sources/layers, apply the frame-0 camera with `jumpTo()`, then wait for `idle`. - Do not add a `mapInstance.remove()` cleanup function; it can interfere with Remotion's render lifecycle. - Use standard MapLibre style JSON URLs and layer/source APIs. - Do not install `@types/maplibre-gl`; MapLibre ships its own types. - Keep required provider attribution visible and verify the current terms of the chosen style and tile providers before rendering. - Record the source and effective date of custom or disputed geography. - Inspect rendered pixels, not only Studio playback, at every required aspect ratio. Coordinates in MapLibre, Turf, and GeoJSON are `[longitude, latitude]`. ```ts const zurich: [number, number] = [8.5417, 47.3769]; const newYork: [number, number] = [-74.006, 40.7128]; ``` ## Prerequisites Install MapLibre and Turf with the project's package manager. ```bash npm i maplibre-gl @turf/turf ``` ```bash bun i maplibre-gl @turf/turf ``` ```bash yarn add maplibre-gl @turf/turf ``` ```bash pnpm i maplibre-gl @turf/turf ``` Import the MapLibre CSS once in the component or an app-level stylesheet: ```ts import 'maplibre-gl/dist/maplibre-gl.css'; ``` ## Basic map example ```tsx import {useEffect, useRef, useState} from 'react'; import {AbsoluteFill, useDelayRender, useVideoConfig} from 'remotion'; import maplibregl from 'maplibre-gl'; import 'maplibre-gl/dist/maplibre-gl.css'; const zurich: [number, number] = [8.5417, 47.3769]; export const MyComposition = () => { const containerRef = useRef<HTMLDivElement>(null); const {delayRender, continueRender} = useDelayRender(); const {width, height} = useVideoConfig(); const [loadingHandle] = useState(() => delayRender('Loading map')); useEffect(() => { if (!containerRef.current) { return; } const mapInstance = new maplibregl.Map({ container: containerRef.current, style: 'https://demotiles.maplibre.org/style.json', center: zurich, zoom: 7, interactive: false, attributionControl: false, fadeDuration: 0, canvasContextAttributes: { preserveDrawingBuffer: true, }, }); mapInstance.on('load', () => { mapInstance.jumpTo({center: zurich, zoom: 7}); mapInstance.once('idle', () => { continueRender(loadingHandle); }); }); }, [continueRender, loadingHandle]); return ( <AbsoluteFill> <div ref={containerRef} style={{width, height, position: 'absolute'}} /> </AbsoluteFill> ); }; ``` Animated examples should keep the loaded map in React state and skip per-frame updates until that state is set. ## Animated flight route example This example shows the recommended pattern for route animations: - Turf creates the route and markers. - Turf slices the route for line reveal animation. - The camera has a separate route from the target route. - MapLibre's `calculateCameraOptionsFromTo()` is used for camera movement. - Frame 0 is prepared before `continueRender()`. ```tsx import * as turf from '@turf/turf'; import {useEffect, useRef, useState} from 'react'; import { AbsoluteFill, Easing, interpolate, useCurrentFrame, useDelayRender, useVideoConfig, } from 'remotion'; import maplibregl, {type GeoJSONSource, type Map} from 'maplibre-gl'; import 'maplibre-gl/dist/maplibre-gl.css'; const zurich: [number, number] = [8.5417, 47.3769]; const newYork: [number, number] = [-74.006, 40.7128]; const greatCircleLine = (from: [number, number], to: [number, number]) => { const route = turf.greatCircle(from, to, {npoints: 100}); if (route.geometry.type === 'LineString') { return turf.lineString(route.geometry.coordinates); } // Great-circle routes crossing the antimeridian can become MultiLineString. // Keep the example valid by choosing the longest segment. const longestSegment = route.geometry.coordinates.reduce((longest, segment) => { return segment.length > longest.length ? segment : longest; }); return turf.lineString(longestSegment); }; const targetRoute = greatCircleLine(zurich, newYork); const targetRouteDistance = turf.length(targetRoute); const cameraRoute = greatCircleLine(zurich, newYork); const cameraRouteDistance = turf.length(cameraRoute); const cityMarkers = turf.featureCollection([ turf.point(zurich, {name: 'Zurich'}), turf.point(newYork, {name: 'New York'}), ]); const clampProgress = (progress: number) => Math.min(1, Math.max(0, progress)); const distanceAlong = (totalDistance: number, progress: number) => { // Keep the route non-empty at progress 0; Turf can error on zero-length slices. return Math.max(0.001, totalDistance * clampProgress(progress)); }; const getPartialTargetRoute = (progress: number) => { return turf.lineSliceAlong( targetRoute, 0, distanceAlong(targetRouteDistance, progress), ); }; const getCameraOptions = ( map: Map, progress: number, cameraAltitudeMeters: number, cameraLatitudeOffset: number, ) => { const target = turf.along( targetRoute, distanceAlong(targetRouteDistance, progress), ).geometry.coordinates; const camera = turf.along( cameraRoute, distanceAlong(cameraRouteDistance, progress), ).geometry.coordinates; return map.calculateCameraOptionsFromTo( new maplibregl.LngLat(camera[0], camera[1] - cameraLatitudeOffset), cameraAltitudeMeters, new maplibregl.LngLat(target[0], target[1]), ); }; export const MyComposition = () => { const containerRef = useRef<HTMLDivElement>(null); const frame = useCurrentFrame(); const {delayRender, continueRender} = useDelayRender(); const {durationInFrames, height, width} = useVideoConfig(); const [map, setMap] = useState<Map | null>(null); const [loadingHandle] = useState(() => delayRender('Loading MapLibre map')); useEffect(() => { if (!containerRef.current) { return; } const mapInstance = new maplibregl.Map({ container: containerRef.current, style: 'https://demotiles.maplibre.org/style.json', center: zurich, zoom: 7, interactive: false, attributionControl: false, fadeDuration: 0, canvasContextAttributes: { preserveDrawingBuffer: true, }, }); mapInstance.on('load', () => { mapInstance.addSource('trace', { type: 'geojson', data: getPartialTargetRoute(0), }); mapInstance.addLayer({ id: 'trace-line', type: 'line', source: 'trace', layout: { 'line-cap': 'round', 'line-join': 'round', }, paint: { 'line-color': '#111111', 'line-width': 7, }, }); mapInstance.addSource('city-markers', { type: 'geojson', data: cityMarkers, }); mapInstance.addLayer({ id: 'city-marker-dots', type: 'circle', source: 'city-markers', paint: { 'circle-color': '#f03b20', 'circle-radius': 12, 'circle-stroke-color': '#ffffff', 'circle-stroke-width': 4, }, }); mapInstance.addLayer({ id: 'city-marker-labels', type: 'symbol', source: 'city-markers', layout: { 'text-allow-overlap': true, 'text-anchor': 'top', 'text-field': ['get', 'name'], 'text-offset': [0, 0.9], 'text-size': 28, }, paint: { 'text-color': '#111111', 'text-halo-color': '#ffffff', 'text-halo-width': 3, }, }); mapInstance.jumpTo(getCameraOptions(mapInstance, 0, 180000, 1.1)); mapInstance.once('idle', () => { setMap(mapInstance); continueRender(loadingHandle); }); }); }, [continueRender, loadingHandle]); useEffect(() => { if (!map) { return; } const handle = delayRender('Rendering MapLibre frame'); const timelineProgress = interpolate(frame, [0, durationInFrames - 1], [0, 1], { extrapolateLeft: 'clamp', extrapolateRight: 'clamp', }); const travelProgress = interpolate(timelineProgress, [0.2, 0.82], [0, 1], { extrapolateLeft: 'clamp', extrapolateRight: 'clamp', easing: Easing.bezier(0.645, 0.045, 0.355, 1), }); const cameraAltitudeMeters = interpolate( timelineProgress, [0, 0.28, 0.74, 1], [180000, 2200000, 2200000, 180000], { extrapolateLeft: 'clamp', extrapolateRight: 'clamp', easing: Easing.bezier(0.645, 0.045, 0.355, 1), }, ); const cameraLatitudeOffset = interpolate( timelineProgress, [0, 0.28, 0.74, 1], [1.1, 8, 8, 1.1], { extrapolateLeft: 'clamp', extrapolateRight: 'clamp', easing: Easing.bezier(0.645, 0.045, 0.355, 1), }, ); const trace = map.getSource('trace') as GeoJSONSource | undefined; trace?.setData(getPartialTargetRoute(travelProgress)); map.jumpTo( getCameraOptions( map, travelProgress, cameraAltitudeMeters, cameraLatitudeOffset, ), ); map.once('idle', () => continueRender(handle)); // Force an idle event even if the camera parameters are unchanged from the previous frame. map.triggerRepaint(); }, [continueRender, delayRender, durationInFrames, frame, map]); return ( <AbsoluteFill style={{backgroundColor: '#e8eef3'}}> <div ref={containerRef} style={{height, position: 'absolute', width}} /> </AbsoluteFill> ); }; ``` ## Camera guidance Use MapLibre's camera helper for camera movement: ```ts map.calculateCameraOptionsFromTo(cameraLngLat, cameraAltitudeMeters, targetLngLat); ``` A good pattern is to keep two concepts separate: - `targetRoute`: where the animated line is and where the camera looks. - `cameraRoute`: where the camera moves. Then use Turf to read positions from both routes for the same progress value: ```ts const target = turf.along(targetRoute, targetDistance * progress).geometry.coordinates; const camera = turf.along(cameraRoute, cameraDistance * progress).geometry.coordinates; map.jumpTo( map.calculateCameraOptionsFromTo( new maplibregl.LngLat(camera[0], camera[1]), cameraAltitudeMeters, new maplibregl.LngLat(target[0], target[1]), ), ); ``` For zoom-out / travel / zoom-in animations, animate travel progress separately from camera altitude. Camera altitude is measured in meters. This avoids heavy custom camera math. ## Lines Use GeoJSON sources for lines. Unless the user asks, do not add glow effects or extra decorative points. For geodesic flight routes, use Turf: ```ts const line = greatCircleLine(start, end); const distance = turf.length(line); const partialLine = turf.lineSliceAlong( line, 0, // Keep the route non-empty at progress 0. Math.max(0.001, distance * progress), ); ``` For a visually straight line on the map, use a simple GeoJSON `LineString` between the two points instead of `greatCircle()`. ## Markers and labels Use map-native GeoJSON layers for markers and labels: ```tsx mapInstance.addSource('markers', { type: 'geojson', data: turf.featureCollection([ turf.point([-118.2437, 34.0522], {name: 'Los Angeles'}), ]), }); mapInstance.addLayer({ id: 'marker-dots', type: 'circle', source: 'markers', paint: { 'circle-color': '#f03b20', 'circle-radius': 12, 'circle-stroke-color': '#ffffff', 'circle-stroke-width': 4, }, }); mapInstance.addLayer({ id: 'marker-labels', type: 'symbol', source: 'markers', layout: { 'text-allow-overlap': true, 'text-anchor': 'top', 'text-field': ['get', 'name'], 'text-offset': [0, 0.9], 'text-size': 28, }, paint: { 'text-color': '#111111', 'text-halo-color': '#ffffff', 'text-halo-width': 3, }, }); ``` Make marker sizes and label font sizes large enough for the composition resolution. ## Styles Default to the stock MapLibre demo style: ```ts style: 'https://demotiles.maplibre.org/style.json' ``` If the user requests another style, use any valid MapLibre style JSON URL. ## Rendering For WebGL map renders, prefer single concurrency and ANGLE: ```bash bunx remotion render [composition-id] out/video.mp4 --gl=angle --concurrency=1 ``` Use the equivalent package runner for the project. In npm projects, use `npx`; in Bun projects, use `bunx`.
-
-
maptiler
-
assets
-
sample-data
-
country-meta.json 325.3 KB
{ "china": { "stop": 0, "anchor": [87.78260869565217, 30.663811291452628], "border": [ [ [104, 22.607404598007214], [103.99006555200009, 22.58534088100008], [103.98556970200013, 22.57025136400007], [103.98556970200013, 22.554541728000103], [103.98737837800013, 22.540175680000104], [103.9853629970001, 22.527153219000056], [103.97399418100008, 22.515267639000044], [103.95952478000004, 22.507102763000105], [103.95094649200013, 22.516456197000068], [103.94071455900007, 22.52467275], [103.92541833500007, 22.528238424000065], [103.91704675300014, 22.533251038000017], [103.90278405800007, 22.55857249000009], [103.89461918200004, 22.56921783500009], [103.88867639200004, 22.571749980000064], [103.87265669800007, 22.573610332000086], [103.86681726100005, 22.575419007000065], [103.84418298400004, 22.599293519000057], [103.8363281660001, 22.60275583900001], [103.82966190600007, 22.609163717000044], [103.80966312700014, 22.638722636000082], [103.80532230700004, 22.647404277000035], [103.79421187400004, 22.659444886000088], [103.72641239500012, 22.716288961000046], [103.65850956200006, 22.79320933000004], [103.64693404200005, 22.799048768000134], [103.60383589700012, 22.776026917000067], [103.59003829000005, 22.76801707], [103.58254520700012, 22.755795593000087], [103.57680912300009, 22.740835267000122], [103.56833418800005, 22.724970602000027], [103.5471468500001, 22.70068267900011], [103.54456302900013, 22.691019185000087], [103.54992302200003, 22.64866216800003], [103.55091923000003, 22.640789694000134], [103.54621667500004, 22.631436259000097], [103.5142806400001, 22.587356262000114], [103.5036352950001, 22.581413473000012], [103.48544519000006, 22.584100647000028], [103.47314620000003, 22.59164540600007], [103.44751469000005, 22.61825876900012], [103.41092777500012, 22.674741109000067], [103.40431319200013, 22.68879709900007], [103.4023494870001, 22.706522115], [103.40400313400005, 22.723885397000018], [103.4017293710001, 22.737838033000102], [103.38751835200003, 22.745176087000104], [103.37894006300013, 22.756777446000044], [103.36875980700006, 22.767138570000057], [103.35708093300008, 22.776026917000067], [103.34416182500007, 22.782977397000067], [103.32157922400012, 22.790392965000095], [103.30964196800011, 22.78793833400003], [103.2699544680001, 22.723265279000046], [103.25248783400008, 22.67856516500011], [103.2448913980001, 22.66869496700012], [103.22840661600003, 22.655827536000018], [103.16846195500011, 22.626475321000058], [103.14174524000009, 22.60704498300008], [103.13001469000005, 22.57795115100005], [103.13259851100008, 22.569786276000045], [103.14469079600008, 22.55578196300003], [103.14572432500006, 22.54555002900007], [103.14200362100013, 22.537798564000056], [103.09125736500005, 22.50508738200007], [103.07441084800007, 22.49816274000007], [103.05828780100006, 22.495475566000053], [103.04418013600008, 22.486483867000018], [103.04485192900006, 22.4728929650001], [103.04908939600011, 22.45682159400006], [103.04505863500009, 22.440543518000126], [103.02903894100007, 22.43015655500001], [103.00893680900009, 22.43031158500004], [102.9890930580001, 22.437597962000027], [102.95653690600005, 22.45971547400005], [102.9195882570001, 22.469223938000127], [102.90258671100008, 22.47723378500008], [102.89369836400004, 22.487362366000056], [102.85928186100011, 22.550510966], [102.85313236500014, 22.568442689000065], [102.8451741940001, 22.585237529000054], [102.83184167500008, 22.599706930000067], [102.81339318800013, 22.608698629000017], [102.77122522000008, 22.617793681000094], [102.75189823400007, 22.625286764000023], [102.69272871900006, 22.6705036420001], [102.67216149900008, 22.67835845900005], [102.63226729400003, 22.684973043000056], [102.61247522000008, 22.691587626000043], [102.60611901900012, 22.696703593000038], [102.59118453000008, 22.712568258000132], [102.58668868000007, 22.716082256000092], [102.5761983650001, 22.713808493000087], [102.57035892700003, 22.70709055600004], [102.56575972500008, 22.699545797], [102.55836999500008, 22.694946595000047], [102.53578739400012, 22.695825094], [102.52891442900005, 22.707814026000037], [102.52633060700003, 22.72595245400008], [102.51578861500008, 22.745176087000104], [102.49434289600009, 22.76039479600003], [102.46778121000006, 22.76858551000005], [102.44271814000012, 22.765174866000038], [102.42561324100006, 22.745305278000032], [102.42561324100006, 22.745176087000104], [102.41522627800009, 22.7098294070001], [102.4072681070001, 22.693447978000037], [102.39496911700007, 22.680528870000032], [102.38463383000004, 22.677738343000087], [102.37316166200003, 22.67835845900005], [102.36272302300011, 22.677428283], [102.35585005700005, 22.669935201000058], [102.35626346800007, 22.658721415000016], [102.3633431400001, 22.65143503800003], [102.37269657400003, 22.64575063100007], [102.37858768800004, 22.639084371000067], [102.38246342000008, 22.63081614200003], [102.38432377100008, 22.628852437000077], [102.37688236500003, 22.615571595000077], [102.25254886900007, 22.495475566000053], [102.24252364200004, 22.477182109000083], [102.23663252800003, 22.443437398000114], [102.23130985600011, 22.426332500000072], [102.2180290120001, 22.410674540000016], [102.20355961100006, 22.41248321500011], [102.18655806500004, 22.421061503000132], [102.16454390500007, 22.425505676000043], [102.14702559400007, 22.421061503000132], [102.12883549000003, 22.410881246000073], [102.11865523300008, 22.39754872600004], [102.10734543400008, 22.39754872600004], [102.10062015800008, 22.405765280000068], [102.0999483650001, 22.414860331000042], [102.09534916200005, 22.423128561000098], [102.08553064000006, 22.429123027000017], [102.07591882300005, 22.432430319000034], [102.01457889800008, 22.446072896000132], [101.9949935300001, 22.4474164840001], [101.97421960500003, 22.445142720000078], [101.95287723800004, 22.436874491000125], [101.90936568200004, 22.435892639000073], [101.89164066600011, 22.42969146700007], [101.88151208500005, 22.412173157000026], [101.87727461800011, 22.39186431900002], [101.86792118300008, 22.378841858000058], [101.84259973100006, 22.38333770800007], [101.81779504400004, 22.406333720000035], [101.7848771570001, 22.472221171000044], [101.75505985600012, 22.49552724300007], [101.7506156820001, 22.496044007000094], [101.74177901200011, 22.496044007000094], [101.7131502680001, 22.491548157000082], [101.68912072800009, 22.478887431000047], [101.66865686100004, 22.46229929700003], [101.65454919500007, 22.446124573000034], [101.64509240800004, 22.42421376500009], [101.64416223200004, 22.4040082800001], [101.64571252500008, 22.384526266000094], [101.64369714400004, 22.364682516000116], [101.64111332200014, 22.363287252000035], [101.62369836500011, 22.346647441000115], [101.6225098060001, 22.342358297000047], [101.61987430900007, 22.32644195500002], [101.60612837700012, 22.284842427000015], [101.60121911700008, 22.27698761000009], [101.58798995000012, 22.27135487900007], [101.5757426350001, 22.27311187800005], [101.56370202700009, 22.276780905000024], [101.55098962400007, 22.276677552000095], [101.54065433700003, 22.271458232000086], [101.5317143150001, 22.263396708000087], [101.51574629800007, 22.245361634000105], [101.51822676600005, 22.22820505800003], [101.54902592000013, 22.19353017200011], [101.56153161700013, 22.17611521400009], [101.56695764200009, 22.149346822000027], [101.5618416750001, 22.13007151300006], [101.55502038600014, 22.112398173000074], [101.55543379800014, 22.090332337000078], [101.56494226100006, 22.069506734000115], [101.59217574100006, 22.02811391300007], [101.60039229400007, 22.007495016000078], [101.60680017100003, 21.96760081000012], [101.61630863500011, 21.953648173000133], [101.6381160890001, 21.940884094000054], [101.67366947500005, 21.931375631], [101.68059411600007, 21.9226423140001], [101.68245446800006, 21.91483917300009], [101.68307458600003, 21.907139384000104], [101.68586511300009, 21.898612773000067], [101.70870609600007, 21.869570618000083], [101.72126346900012, 21.844352519000054], [101.72617272900004, 21.837272848000012], [101.7510807700001, 21.81613718700008], [101.75154585800004, 21.806370341000033], [101.73165043200004, 21.75050811800004], [101.72798140500004, 21.7326797490001], [101.72854984500009, 21.717538554000086], [101.73278731300013, 21.71144073500004], [101.74911706500006, 21.698056539000092], [101.75480147300004, 21.689788310000054], [101.75562829600005, 21.68002146400009], [101.75232100500006, 21.659144186000034], [101.75593835500013, 21.648653870000075], [101.77082116700007, 21.638835348], [101.78952803600004, 21.634029440000077], [101.80384240700005, 21.62591623900009], [101.8061678470001, 21.60596913700006], [101.79355879700006, 21.588244121000045], [101.77268151900006, 21.582508036], [101.75092574100006, 21.57966583300002], [101.73619795800005, 21.570880839000026], [101.73475101700006, 21.554396057000062], [101.74823856600005, 21.514501852000123], [101.74425948100009, 21.495588277000067], [101.72968672700011, 21.474245911000068], [101.7255526130001, 21.37538889600002], [101.71557906100008, 21.338181865000095], [101.71511397300003, 21.321128642000062], [101.72250370300003, 21.30423044800007], [101.73650801600007, 21.292293193000134], [101.7885461840001, 21.274206442000022], [101.80115523300003, 21.267075094000077], [101.81226566600003, 21.25813507100007], [101.82022383600008, 21.247283020000012], [101.82373783400004, 21.234467265000134], [101.8228076580001, 21.224131979000035], [101.82149033400009, 21.221071138000084], [101.81929366100013, 21.215967102000022], [101.81329919500013, 21.209559225000064], [101.80523767100004, 21.204494934000095], [101.79603926600004, 21.20294464100006], [101.77356001800013, 21.207388815000073], [101.76007246900008, 21.19596832300006], [101.7635864660001, 21.18465118400009], [101.77020105000003, 21.170440166000034], [101.76845334900003, 21.16044957700005], [101.76673872900005, 21.150648092000054], [101.75599003200006, 21.143258362000054], [101.73748986800013, 21.137573954000104], [101.71790450000009, 21.134473369000048], [101.70426192200011, 21.135093485000127], [101.68829390500014, 21.145842183000056], [101.67015547700004, 21.17705474900002], [101.65511763500012, 21.18919871100003], [101.63594567900003, 21.189457092000097], [101.59651656100004, 21.173385722000134], [101.58178877800003, 21.175659485000054], [101.57724125200008, 21.18516794800003], [101.58096195500008, 21.194728089000037], [101.58664636300006, 21.204236552000012], [101.58819665600004, 21.21333160400009], [101.58395918800011, 21.2243903600001], [101.57967004400012, 21.227594299000074], [101.57290043100011, 21.228162740000116], [101.53910404500004, 21.23885976100003], [101.51760664900007, 21.242632141000044], [101.49512740100005, 21.2428388470001], [101.38149092600008, 21.22247833200008], [101.36226729400005, 21.215812073000066], [101.31389815300014, 21.184754537000018], [101.29271081600007, 21.176072897000054], [101.27529585800005, 21.174109192000046], [101.25974125100004, 21.179483541000096], [101.24434167500004, 21.192867737000128], [101.23478153500014, 21.206251933000075], [101.22036381100003, 21.23369211800012], [101.20899499500013, 21.245526021000032], [101.21907189900008, 21.28247467100006], [101.22036381100003, 21.296272278000018], [101.2184001060001, 21.29994130500002], [101.20951176000005, 21.308674622000083], [101.20744470200003, 21.31482411700007], [101.22284427900007, 21.33508127800006], [101.23478153500014, 21.363658345000132], [101.23312788900006, 21.371719869000017], [101.23080244900007, 21.371771546000033], [101.22646163000007, 21.370893046], [101.20796146700013, 21.38350209600013], [101.17912601800003, 21.39817820200001], [101.17142622900013, 21.403397522000134], [101.16827396700006, 21.424533183000065], [101.18775598100007, 21.505871887000083], [101.18656742400003, 21.53532745400007], [101.17452681500004, 21.551657206000115], [101.15902388500007, 21.5526907350001], [101.15421797700003, 21.568038635000065], [101.1577319750001, 21.586228740000095], [101.16765384900009, 21.600181376000094], [101.17385502100007, 21.611911926000076], [101.16672367300004, 21.623280742000063], [101.1688424080001, 21.637853496000034], [101.1614526780001, 21.65836903900002], [101.14925704000007, 21.676765849], [101.13633793100007, 21.684724019000058], [101.12765629100005, 21.695162659000104], [101.12486576400005, 21.74415191700011], [101.11887129800004, 21.759809876000062], [101.08280114800004, 21.766734518000064], [101.06869348200013, 21.76203196200008], [101.05530928600007, 21.754538880000027], [101.04290694200012, 21.745392152000065], [100.99278080300007, 21.71144073500004], [100.97428064000007, 21.704154358000054], [100.87749068200003, 21.677334290000047], [100.83490930200009, 21.657542217000085], [100.79703047700008, 21.626122946000052], [100.75661950700004, 21.569847310000043], [100.70396122300008, 21.51641387900004], [100.66153487100007, 21.49553660100007], [100.66132816600003, 21.495329896], [100.64577356000007, 21.479878642000116], [100.62174401800007, 21.469078268000075], [100.57182458500012, 21.45507395500006], [100.5459863690001, 21.453006897000094], [100.49710046400003, 21.4617918900001], [100.4742594810001, 21.45683095300005], [100.45668949400005, 21.455022278000044], [100.44346032800013, 21.463497213000053], [100.43426192300012, 21.478380026000096], [100.42930098500005, 21.495381572000028], [100.39912194900006, 21.518894348000018], [100.38367069500009, 21.527834371000054], [100.36325850400004, 21.53176178000011], [100.34196781400004, 21.53036651700002], [100.32651656100006, 21.524268698000057], [100.31463098200004, 21.512951559], [100.30248702000011, 21.49553660100007], [100.30228031400009, 21.495329896], [100.28951623500012, 21.483134258000078], [100.27520186400011, 21.475176087000037], [100.24409265100007, 21.464530742000036], [100.23024336800012, 21.45683095300005], [100.19789392100012, 21.433214824000046], [100.18714522300007, 21.427892151], [100.16249556500009, 21.43636708600009], [100.12833744300008, 21.482359110000075], [100.1077702230001, 21.49553660100007], [100.09727990800008, 21.508300680000033], [100.08999353000007, 21.528919577000025], [100.08606612200003, 21.550933737000022], [100.08560103400009, 21.567573548000027], [100.08864994300012, 21.581836243000012], [100.0948511150001, 21.59883778900003], [100.10394616700006, 21.615632629000103], [100.11572839400009, 21.629481914000067], [100.12611535700012, 21.6348562620001], [100.13619226100013, 21.63681996700005], [100.14373702000006, 21.640023906000025], [100.14632084200008, 21.649222310000127], [100.14280684400012, 21.654906718000078], [100.13515873200004, 21.662348124000076], [100.12053430200007, 21.673665263000075], [100.08234541900003, 21.684465638000106], [99.99671757100003, 21.686119283000053], [99.96069909700003, 21.70477447500012], [99.95026045800012, 21.72115590400007], [99.93920170100012, 21.77701812800005], [99.92209680200006, 21.812261455000012], [99.91796268700006, 21.8291596480001], [99.92018477400006, 21.852000631000024], [99.95527307100008, 21.924554342000036], [99.96566003400011, 21.963001608000084], [99.95046716400009, 21.995351054000068], [99.9398218180001, 22.005893046000025], [99.93434411600009, 22.018863831000047], [99.93491255700013, 22.03250640900005], [99.94240564000006, 22.04552886900011], [99.86685469600008, 22.057879537000062], [99.84783776900008, 22.055037333000072], [99.84230839000008, 22.047027486], [99.84173995000003, 22.027080384000087], [99.83367842700005, 22.01948394800003], [99.82101770100007, 22.017778626000066], [99.81342126500004, 22.022997946000075], [99.80747847600003, 22.03095611600004], [99.79988204000006, 22.037467347000117], [99.73916223200007, 22.066767884000072], [99.72365930200004, 22.07059194000003], [99.70381555200004, 22.061238505000077], [99.69379032400013, 22.046924133000076], [99.68386844900004, 22.039017639000022], [99.66381799300007, 22.04873280900007], [99.65927046800005, 22.054572245000045], [99.65007206200005, 22.071935527000065], [99.64221724500004, 22.079945374000047], [99.63353560400009, 22.084751282000056], [99.53896773300005, 22.106713766000027], [99.50506799400006, 22.103354798000012], [99.49039188700004, 22.104336650000064], [99.43861210200009, 22.12423207600007], [99.42496952300007, 22.12242340100009], [99.36492150900006, 22.098858948], [99.32998824100008, 22.095551656000097], [99.25288700400006, 22.102786357000056], [99.2122693280001, 22.112449849000072], [99.16638065600006, 22.13208689400001], [99.14446984900007, 22.153532613000053], [99.17506229700007, 22.168673808000065], [99.15935266100013, 22.184693502000115], [99.16638065600006, 22.204640605000023], [99.1993502200001, 22.245258281000062], [99.20617150900006, 22.261329651000025], [99.21836714700004, 22.310008851000063], [99.22570520000005, 22.321222637000105], [99.24368859900005, 22.34122141600004], [99.2483394780001, 22.353675435000028], [99.24637577300007, 22.365922750000053], [99.24058801300009, 22.372950745000068], [99.23738407400003, 22.38013376900001], [99.24306848200007, 22.39315623000006], [99.28275598100004, 22.411914775000056], [99.3450777590001, 22.472841288], [99.35344934100004, 22.484106751000056], [99.35779016200013, 22.495475566000053], [99.35634322100003, 22.50617258700005], [99.34662805200003, 22.523070781000044], [99.34414758300005, 22.533251038000017], [99.34704146400003, 22.55335317000008], [99.35737675000013, 22.587097881000048], [99.35499963400008, 22.60854360000006], [99.30787072800007, 22.719596252000045], [99.30797408000012, 22.745176087000104], [99.31696578000003, 22.754116109000037], [99.32719771300003, 22.76049814900007], [99.33846317600006, 22.764916484000068], [99.3506588140001, 22.76814626100004], [99.3590303960001, 22.77489003500007], [99.37887414600004, 22.813233948000075], [99.40357548100008, 22.841061707000065], [99.41442753200005, 22.856900533000058], [99.416908, 22.874341330000092], [99.41122359200006, 22.919248149000097], [99.41339400300006, 22.930746155000023], [99.42993046000004, 22.936740622000045], [99.48450077400008, 22.910256450000063], [99.51529992700006, 22.90880951000007], [99.53803755700011, 22.92643117300004], [99.53462691200008, 22.949323832000076], [99.49876346900004, 22.99516082800004], [99.49039188700004, 23.0120073450001], [99.49163212100012, 23.028207906000105], [99.49504276500005, 23.043478292000046], [99.49307906100012, 23.057379252000132], [99.47819624900006, 23.0657508340001], [99.40326542100007, 23.068334656], [99.38104455600006, 23.08164133800001], [99.35096887200007, 23.11926178000003], [99.33381229700012, 23.129622904000044], [99.31407189900006, 23.126470642000086], [99.30218632100014, 23.112595520000028], [99.29402144400012, 23.096782532000034], [99.28482303900012, 23.088152568000098], [99.26673628800012, 23.08386342400003], [99.25743452900008, 23.07921254500006], [99.23614384000007, 23.062314352000058], [99.22487837700004, 23.056888327000095], [99.21661014900008, 23.057379252000132], [99.20958215400009, 23.061539206000063], [99.20214074800003, 23.067275289000023], [99.19966027900006, 23.073838196000096], [99.1993502200001, 23.09226084400011], [99.1941825770001, 23.09577484200007], [99.18488081900006, 23.0948446660001], [99.18271040800005, 23.095206401], [99.17867964700008, 23.09642079700005], [99.16400354000007, 23.09768687000009], [99.1386820890001, 23.105205790000028], [99.13000044800003, 23.10623931900001], [99.09217329900008, 23.101510926000017], [99.0749133710001, 23.10166595500006], [99.05506962100009, 23.109598287000026], [99.0392566330001, 23.127142436000085], [99.03315881300006, 23.146417745000022], [99.02644087800013, 23.160447897000026], [99.00938765500007, 23.162153218000086], [98.99037072800013, 23.160034485000025], [98.9707336840001, 23.162204895000016], [98.93342330000013, 23.172152608000104], [98.85900923700012, 23.179387309000063], [98.86014611800005, 23.212279358000032], [98.91068566900009, 23.297597148000094], [98.89652632700012, 23.323280335000064], [98.86045617700012, 23.322375997000037], [98.85342818200007, 23.3248823040001], [98.85322147600004, 23.334985047000046], [98.86210982300008, 23.340591940000067], [98.87378869600013, 23.344571025000064], [98.88185022000005, 23.34968699200006], [98.89011844900006, 23.3679029340001], [98.89228886000006, 23.386894023000067], [98.88960168400013, 23.406789449000073], [98.87554569500003, 23.44642527300003], [98.86397017400009, 23.46660491900012], [98.84888065700005, 23.480402527000066], [98.83007043500004, 23.480014954000055], [98.80981327300003, 23.474098002000048], [98.7999947510001, 23.48073842400005], [98.78087447100006, 23.532854106000016], [98.78438846900013, 23.54703928700006], [98.7962740480001, 23.557917175000043], [98.84329960100007, 23.5840137740001], [98.85022424400012, 23.590628357000114], [98.85735559100004, 23.604348450000046], [98.85601200400009, 23.610007020000083], [98.84960412600009, 23.614735413000076], [98.80795292200003, 23.67579111800005], [98.80030481000006, 23.69271514900005], [98.79906457500005, 23.743228862000066], [98.79317346200003, 23.758473409000104], [98.77787723800009, 23.76929962100006], [98.73839644400005, 23.77555247000005], [98.70832076000005, 23.78469919800004], [98.68496301300013, 23.784802551000084], [98.67566125500008, 23.787386373000075], [98.66367232300013, 23.796946513000066], [98.66356897000003, 23.803070171000044], [98.66832320200012, 23.808702902000064], [98.67142378700004, 23.816738587000046], [98.66418908700007, 23.89037750200005], [98.66480920400005, 23.9033741250001], [98.67297408100006, 23.928308004000073], [98.6745243740001, 23.936886292000096], [98.6657393800001, 23.953216045000133], [98.65881473800005, 23.961122539000073], [98.66325891200012, 23.969545797000066], [98.67989872200008, 23.976263733000096], [98.69922570900007, 23.981560568000035], [98.71679569500009, 23.988407695], [98.76557824800005, 24.02706166600008], [98.85621871000006, 24.083802388000024], [98.87347863800005, 24.11449819000005], [98.86696740800011, 24.143256124000075], [98.86572717300004, 24.145684917000025], [98.85528853400012, 24.13896698000009], [98.8180815020001, 24.12896759100009], [98.7161755780001, 24.12134531700012], [98.68175907400007, 24.106875916], [98.64041792900014, 24.100752258000014], [98.61251265500005, 24.087548930000125], [98.59711307800006, 24.083078919000016], [98.58522749900004, 24.075715027000015], [98.57024133400006, 24.08209706600006], [98.54305953000005, 24.093956807000083], [98.50326867700005, 24.121267802000077], [98.47453658000006, 24.127830709000065], [98.43495243300009, 24.130259501000026], [98.39557499200009, 24.128063253000036], [98.37872847500012, 24.122404684000102], [98.3473092050001, 24.10493804900007], [98.33066939300005, 24.099486186000078], [98.2932556560001, 24.10013214100006], [98.21915165200005, 24.117366231000048], [98.18153120900013, 24.118658142000086], [98.10505009000008, 24.101527405000027], [97.88997277800013, 24.022617493], [97.87664025900011, 24.014400940000044], [97.83633264200006, 23.971767883000084], [97.81783247900012, 23.95815114400007], [97.8040865480001, 23.954507955000068], [97.78951379400013, 23.95313853], [97.76780969300012, 23.946472270000086], [97.74817264900008, 23.93406992600002], [97.69680627400004, 23.887121887000077], [97.67696252500014, 23.878698629000084], [97.65567183400009, 23.87254913300002], [97.64734483100005, 23.868524415000067], [97.63706831900004, 23.86355743500006], [97.62466597500003, 23.846710918], [97.61970503700007, 23.865986226000032], [97.61546757000013, 23.875132955000097], [97.60988651500003, 23.88314280200008], [97.5726794840001, 23.907559916000125], [97.53299198400003, 23.92370880200012], [97.51645552600013, 23.942829081000113], [97.70765832500007, 24.12529856400009], [97.72006066900008, 24.1474419150001], [97.72305790200005, 24.171264751000066], [97.71871708200007, 24.181548361000083], [97.70455774000004, 24.19924753800008], [97.70156050600013, 24.210926412000063], [97.70466109300008, 24.221726786000076], [97.71117232300003, 24.228470561000037], [97.71851037600004, 24.233974101000015], [97.72409143100003, 24.241518860000056], [97.71840702300011, 24.277666524], [97.64450972500003, 24.302393698000103], [97.63820520100012, 24.328102722], [97.65360477700011, 24.338722229000084], [97.67427535100012, 24.340840963000048], [97.68957157400007, 24.346473694000068], [97.68833134000005, 24.36771270800004], [97.68099328600005, 24.377763774000087], [97.66259647700014, 24.390062765000025], [97.65732548000011, 24.402000020000074], [97.6554651290001, 24.412076925000108], [97.65226119000005, 24.422722270000108], [97.6473002520001, 24.432334086000097], [97.6398588460001, 24.439284567000087], [97.62435591600007, 24.442281799000014], [97.60068811000014, 24.44192006400003], [97.51955611200009, 24.430783794], [97.51325158700007, 24.438586935], [97.51387170400005, 24.46168629900008], [97.53857303900003, 24.597259420000015], [97.53278527800006, 24.723324077000072], [97.53609257000005, 24.745028178000084], [97.5361959230001, 24.745079854], [97.60399540200012, 24.78644683900002], [97.6425460210001, 24.816780904000055], [97.66394006400003, 24.829777527000104], [97.68595422400011, 24.833524068000102], [97.72657190000012, 24.826289368000047], [97.74848270700011, 24.826470235], [97.76522587100004, 24.834660950000043], [97.77297733600005, 24.85468556800008], [97.76098840300006, 24.870291850000015], [97.72409143100003, 24.897215272000025], [97.70827844300004, 24.927290955], [97.70331750500003, 24.960415548000086], [97.70517785700014, 25.02883514400007], [97.69959680200009, 25.065008647000113], [97.7036275640001, 25.073922831000047], [97.72161096200006, 25.079271342000098], [97.73752730300009, 25.090510967000043], [97.7540637620001, 25.11355865500009], [97.77700809800012, 25.15862050400004], [97.80098596300013, 25.237633769000112], [97.82362023900009, 25.26161163300013], [97.86031050700007, 25.244093323000058], [97.87178267400009, 25.227660217], [97.87881066900007, 25.213552551000063], [97.88893925000013, 25.205646057000124], [97.90991988100006, 25.20755808500006], [97.93079716000011, 25.218513489000102], [97.97627242100009, 25.27225697900012], [97.99239546700005, 25.28248891200009], [98.03352990700012, 25.301299134000104], [98.04489872300013, 25.311944479000104], [98.06257206300012, 25.35431915300002], [98.0756978760001, 25.376074932000037], [98.08996057100006, 25.385945129], [98.10835738100008, 25.388890686000096], [98.11207808500006, 25.396228739000023], [98.11021773300007, 25.410439759000056], [98.11197473100003, 25.448473613000104], [98.10887414600012, 25.458240459000066], [98.10474003100006, 25.466973775000028], [98.09946903500003, 25.493328756], [98.09977909300005, 25.50004669200011], [98.10463667800013, 25.506764628000056], [98.12303348900014, 25.522215882000054], [98.13419559800008, 25.534618225000102], [98.13936324100007, 25.550224508000056], [98.13843306500013, 25.598955384000092], [98.1400867110001, 25.611461080000097], [98.15021529100005, 25.613063050000036], [98.23238081900007, 25.586553040000027], [98.24716027900007, 25.579163310000112], [98.2766158450001, 25.552446594000045], [98.28943160000006, 25.550379538000087], [98.31206587700012, 25.55745920800011], [98.3326330970001, 25.566967672000104], [98.34710249800003, 25.577819723000047], [98.35723107900009, 25.592754212], [98.36984012900012, 25.636782532000055], [98.37521447800009, 25.649288229000078], [98.41324833200008, 25.69207631400009], [98.41634891800004, 25.700189514], [98.41665897600012, 25.712591859000057], [98.41872603400009, 25.724219056000024], [98.42472050000003, 25.730833639000124], [98.43226525900008, 25.736104635000046], [98.43929325400006, 25.7435977170001], [98.45262577300008, 25.777962545000022], [98.46130741400009, 25.79465403300007], [98.47453658000006, 25.80576446500008], [98.49810103400006, 25.830724183000072], [98.50946984900003, 25.838062236000056], [98.52683313100005, 25.838785706000053], [98.53954553200003, 25.833721415000085], [98.56238651600012, 25.816358135000073], [98.59091190600009, 25.806384583000053], [98.60031701600013, 25.801733704000085], [98.61003218700006, 25.800596822000088], [98.62605188000003, 25.806487936000067], [98.6778316650001, 25.843281555000075], [98.68485966000003, 25.853100078000054], [98.69023400900005, 25.86555409700013], [98.69240441900007, 25.87898997100008], [98.68982059800004, 25.8915990200001], [98.68465295400006, 25.897593486000048], [98.67235396300009, 25.90183095400009], [98.66728967300003, 25.905758362000043], [98.65809126800013, 25.925033671000094], [98.62532841000012, 25.969992168000104], [98.61623335800004, 25.979397278000064], [98.6042444260001, 25.982497864], [98.59246219900007, 25.98074086500013], [98.5824369720001, 25.98229115900004], [98.57540897700005, 25.99510691300013], [98.57716597500013, 26.01732778000006], [98.5726184500001, 26.035569560000013], [98.5538082280001, 26.071071269000058], [98.54729699800004, 26.088279521000047], [98.54553999900003, 26.105642803000066], [98.55019087800008, 26.12078399700006], [98.5630066330001, 26.131222636000118], [98.60217736800013, 26.13995595300007], [98.61933394400012, 26.145743714000062], [98.62574182200012, 26.144348450000066], [98.62429488100014, 26.108485006000038], [98.63080611200013, 26.096909485000097], [98.64444869000005, 26.097891337000064], [98.68082889800013, 26.12496978800003], [98.68672001200008, 26.133238017000068], [98.68651330600005, 26.15411529600003], [98.69240441900007, 26.159954732000116], [98.70025923700007, 26.16532908200007], [98.7055302330001, 26.174940898000088], [98.70149947100003, 26.191167298], [98.67700484200009, 26.239329733000076], [98.66821984900008, 26.248218079000097], [98.64816939300005, 26.244807434000066], [98.6421749270001, 26.25452260400003], [98.64455204300003, 26.271575827000035], [98.64951298000011, 26.290592753000013], [98.65778120900006, 26.31162506100013], [98.6976754150001, 26.35405141200006], [98.70739058400011, 26.371052959000068], [98.7134884030001, 26.389449768000063], [98.7172091060001, 26.408725077000028], [98.72113651600006, 26.538898011000086], [98.72795780400003, 26.57259104500004], [98.74852502400012, 26.6059740190001], [98.7555530190001, 26.625042623000084], [98.75069543500007, 26.646126607000028], [98.74707808400012, 26.655738424000035], [98.74676802600004, 26.664420064000083], [98.74738814300008, 26.672688293000036], [98.74645796800013, 26.681059876000106], [98.73198856700003, 26.71351267500002], [98.73436568300014, 26.73428660100008], [98.74924849500007, 26.77144195600006], [98.75038537600011, 26.792009176000064], [98.74242720500013, 26.81040598600005], [98.71813928200004, 26.842497050000063], [98.71452193200008, 26.862030741000083], [98.71865604700008, 26.872676087000073], [98.73312544800012, 26.88792063400011], [98.73632938600008, 26.89825592100003], [98.73570927000003, 26.907299296000062], [98.71266158100008, 26.995149231000042], [98.72061975100013, 27.013959452000066], [98.73167850700003, 27.031064352], [98.73777632600007, 27.048686015], [98.73136844900006, 27.068788147000063], [98.71648563700012, 27.082482402000082], [98.70273970500006, 27.086823222000064], [98.69137089100008, 27.092404276000067], [98.68268925000012, 27.110077617000073], [98.67256066900006, 27.17560333200008], [98.67359419800005, 27.207901103000054], [98.68020878100003, 27.237046611000082], [98.70418664600004, 27.304174296000028], [98.70770064400011, 27.337247213000083], [98.69736535700008, 27.368924866], [98.69106083200006, 27.373162334000043], [98.6837227790001, 27.37362742200007], [98.67731490100005, 27.376107890000057], [98.67442102100006, 27.3865982060001], [98.66832320200012, 27.475249126000094], [98.67111372900007, 27.516151022000102], [98.68175907400007, 27.55648447700007], [98.67927860500009, 27.57733591800003], [98.67421431500003, 27.586120911000123], [98.6657393800001, 27.597076315], [98.65592085800006, 27.60676564500004], [98.6472392170001, 27.611726583000078], [98.63504357900007, 27.611054789], [98.62584517500005, 27.6055512490001], [98.61654341700006, 27.59841990200006], [98.60455448400006, 27.59273549400011], [98.5784062090001, 27.59172780400003], [98.56435022000005, 27.603535869000055], [98.54336958800008, 27.642525737000042], [98.5221822520001, 27.656297506000087], [98.4923132730001, 27.643430074], [98.47453658000006, 27.65717600500004], [98.42224003100006, 27.680895487000058], [98.4102510990001, 27.68425445600009], [98.40001916500012, 27.675727844000065], [98.3974353430001, 27.656814270000027], [98.39815881400011, 27.619813945000075], [98.39288781700009, 27.587154440000106], [98.38327600100007, 27.55578684500007], [98.36394901500012, 27.532170716000067], [98.32860233600007, 27.52286895700003], [98.29470259600009, 27.536614889000063], [98.27568566900004, 27.570101217000072], [98.25439497900004, 27.648132629000074], [98.23806522600012, 27.680223694000077], [98.20437219300004, 27.727300924000062], [98.20178837100013, 27.736551005000095], [98.21150354000008, 27.760322164000044], [98.20840295400006, 27.766161601000036], [98.20209842900005, 27.7712517290001], [98.1978609620001, 27.780631002000078], [98.19848107900003, 27.800448914000057], [98.20065148900005, 27.813600565000016], [98.19662072800003, 27.823186544000023], [98.16241092900003, 27.842849427000075], [98.14577111900013, 27.860729472000045], [98.1400867110001, 27.878557841000074], [98.1567265220001, 27.889203187000064], [98.17667362500003, 27.898117371000083], [98.17729374200007, 27.91292266900011], [98.16582157400006, 27.92969167100007], [98.14897505700009, 27.944548645000012], [98.11352502500006, 27.96170522100006], [98.10711714700011, 27.973074036000057], [98.11848596200014, 27.99472646100004], [98.12251672400004, 28.015448710000058], [98.1279944260001, 28.105469056000018], [98.12696089700012, 28.124279277000042], [98.11869266800005, 28.140789897000033], [98.1150022760001, 28.14388835700008], [98.04861942600013, 28.199623515000027], [98.03135949800003, 28.208330994000065], [97.9910518800001, 28.214015401000026], [97.98485070800012, 28.2242214970001], [97.99384240800003, 28.25254018200009], [97.9929122320001, 28.26892161100004], [97.97875288900013, 28.280600484], [97.9447497970001, 28.29884226500006], [97.8975175380001, 28.35532460500012], [97.85907027200005, 28.370129903000034], [97.79726525900003, 28.34392995200001], [97.76532922400008, 28.352430725000133], [97.74000777200007, 28.38260976200003], [97.69959680200009, 28.48802968300008], [97.67045129400009, 28.511284079000077], [97.6410990810001, 28.498364970000083], [97.61360721800003, 28.481983541000133], [97.58993941300008, 28.49469594300008], [97.56751184100011, 28.525495097000046], [97.54622115100011, 28.53846588100008], [97.52772098800011, 28.52952585900006], [97.51397505800009, 28.49469594300008], [97.50301965300008, 28.47772023600008], [97.48813684100003, 28.44193430600005], [97.47459761600004, 28.426198832000082], [97.47149703000014, 28.414959209000116], [97.46570927000005, 28.40669097900006], [97.45010298700004, 28.39191152000005], [97.44534875500011, 28.382971497000128], [97.4467956950001, 28.374005636000092], [97.45020634000014, 28.364858907], [97.45237674900005, 28.355479635000066], [97.45237674900005, 28.317678324000084], [97.44782922400009, 28.29760203100004], [97.43666711400004, 28.286414083000082], [97.41672001200004, 28.286052348000098], [97.3982198490001, 28.28889455200006], [97.38437056500004, 28.284837952000075], [97.3778593350001, 28.26359893900009], [97.36959110600003, 28.25347035700004], [97.33383101400011, 28.235254415], [97.32349572800013, 28.217477723000073], [97.2852551680001, 28.235667827], [97.22965132700011, 28.274606018000085], [97.22076298000007, 28.28339101200008], [97.21053104700013, 28.308092346000066], [97.20277958200012, 28.31155466700004], [97.19327111900003, 28.311399638000083], [97.18272912600008, 28.31499115000007], [97.11554976400004, 28.366564230000066], [97.07844608600004, 28.3751425170001], [97.03297082600005, 28.357029928000074], [96.9974174400001, 28.337082825000053], [96.96579146400012, 28.330468242000066], [96.93395878200005, 28.336617737000026], [96.89788863200005, 28.354704489000042], [96.71692392905247, 28.436539447625634], [96.60442611830537, 28.444534241434948], [96.5615177204665, 28.44729288316006], [96.51238244700005, 28.428808492000073], [96.49522587100006, 28.42147043900009], [96.44112658162652, 28.39541577691665], [96.36964414401973, 28.378115826943503], [96.30185249373439, 28.420710938634112], [96.33645875408492, 28.47966681390912], [96.40901887262294, 28.558928647938785], [96.50237514126326, 28.644476217418358], [96.50104350465409, 28.687631303142155], [96.59800971353144, 28.709910398443995], [96.59258426900004, 28.757884013000094], [96.57666792800006, 28.808526917000066], [96.52375126100003, 28.864414979000045], [96.51083215400013, 28.885524801000074], [96.50039351400005, 28.929243062000054], [96.49222863800003, 28.94800160700005], [96.47465865100008, 28.962057597000054], [96.46008589700011, 28.963349507000103], [96.45212772700006, 28.970377502000034], [96.45119755100012, 28.98138458300012], [96.45760542900013, 28.99458791100001], [96.36656829155606, 29.036536563468914], [96.29465549772947, 28.99232448388489], [96.24858762565306, 28.945343306324006], [96.19532275757172, 28.941105845485463], [96.17595371463305, 29.017353609711428], [96.17462528500005, 29.108844503000043], [96.1835136310001, 29.123778992000027], [96.19364221300003, 29.13693064400009], [96.21007531700008, 29.145767314000082], [96.31642541500008, 29.171863912000063], [96.32748417200008, 29.180442200000087], [96.34236698400014, 29.21064707500001], [96.36686161300008, 29.24421091700013], [96.36624149600004, 29.257233379000056], [96.34991174300006, 29.274234924], [96.33709598900009, 29.27971262700008], [96.32324670400004, 29.275010071000096], [96.30412642400006, 29.261212464000053], [96.26784956900008, 29.24173044900006], [96.23529341600005, 29.241213684000016], [96.20542443800014, 29.256949158000097], [96.17627893100013, 29.28645640100011], [96.16604699800013, 29.303173726000054], [96.15095747900011, 29.35407501200008], [96.14196578000008, 29.368466899000097], [96.07453626532634, 29.369285607240855], [96.01413548284108, 29.364252208700393], [95.95373470035588, 29.35921881015993], [95.86313352662813, 29.32398502037684], [95.79594038900007, 29.352886455000046], [95.77640669800007, 29.345548401000073], [95.74478072100004, 29.340432435000068], [95.7473653601981, 29.27365103497256], [95.71716496895556, 29.218283651027733], [95.64669738938943, 29.22835044810863], [95.59233524600006, 29.249688619000025], [95.58168990100006, 29.24746653300012], [95.57290490800006, 29.247259827000065], [95.56442997300007, 29.2456061810001], [95.55378462800007, 29.239043275000128], [95.55068404100012, 29.230284119000046], [95.55202762800008, 29.220129700000072], [95.55016727700007, 29.212481588000017], [95.51533736200014, 29.209432679000074], [95.51192671700011, 29.19754709900006], [95.52267541500004, 29.161192729000064], [95.52143518100007, 29.13786082000003], [95.51130660000013, 29.131788839000095], [95.48757683710141, 29.068994487006023], [95.42982403198397, 29.046524645630395], [95.36740605062847, 29.03649616327051], [95.2815531820001, 29.052672221000094], [95.22491581200012, 29.05936431900001], [95.21633752500009, 29.06499705000003], [95.21406376100009, 29.07308441200003], [95.21282352700013, 29.08186940500012], [95.2078625900001, 29.089595032000105], [95.19969771300003, 29.094245911000073], [95.19153283800006, 29.096829733000092], [95.11691206900008, 29.108095195000047], [95.09903202400011, 29.113779603000083], [95.04766564900007, 29.140806377000033], [94.98906457600003, 29.15398386700012], [94.89129276600005, 29.160495097000094], [94.85408573500007, 29.17000356000007], [94.81543176300005, 29.16886667900006], [94.79879195200004, 29.1664378870001], [94.77657108500011, 29.16669626900007], [94.76148156800008, 29.174706116000053], [94.76768273900007, 29.21385101300008], [94.75641727800013, 29.230516663000017], [94.70422408000013, 29.284699402000044], [94.66846399000013, 29.306610209000084], [94.6304301350001, 29.319451803000064], [94.59994104000009, 29.316635437000016], [94.5826811120001, 29.302915345000073], [94.52862756400003, 29.2312401330001], [94.51477828000009, 29.22105987600004], [94.49824182200007, 29.21522043900005], [94.47498742700003, 29.210802104000052], [94.42238081900007, 29.210492045000066], [94.39643925000013, 29.207081400000035], [94.37287479700012, 29.19630686500001], [94.36253951000009, 29.185325623000026], [94.34631311100009, 29.1590739950001], [94.33577111900013, 29.149617208000038], [94.32378218600007, 29.146025696000052], [94.28750533100003, 29.147937724000073], [94.27078578096348, 29.097929973215642], [94.30904814105469, 29.059667613124404], [94.34731050114596, 29.024348511501685], [94.29138859024334, 28.977256376004746], [94.2501829716835, 28.933107498976327], [94.17365825150097, 28.930164240507835], [94.1353958914097, 28.897788397353693], [94.07947398050715, 28.883072105010925], [94.02684940600011, 28.864182435000075], [94.01144982900013, 28.85302032500003], [93.99201949100012, 28.844648743000064], [93.99313607399837, 28.80188742309345], [93.9815905577272, 28.768130860141966], [93.96109345404737, 28.72994349590268], [93.92778566056765, 28.68275160171495], [93.86307969177443, 28.704870831024095], [93.78174379684887, 28.68050383781251], [93.72247522000009, 28.696647441000053], [93.70552535000007, 28.69189320900007], [93.66490848182954, 28.690238755807428], [93.64341027900008, 28.680240174000105], [93.62553023300006, 28.67235951800005], [93.60713342300005, 28.672204488000105], [93.55173628800009, 28.67894826200005], [93.44621301300003, 28.671894430000023], [93.35543239724171, 28.624065359777703], [93.31717003715039, 28.603462550497838], [93.30284340070244, 28.556921073348917], [93.2869721652333, 28.520517242676647], [93.25906765301328, 28.496023260000364], [93.21883846222534, 28.457435846387227], [93.1862858334245, 28.431995228097378], [93.21807344565363, 28.39464655767386], [93.20782489381371, 28.340539283245555], [93.12982812476821, 28.325961566073488], [93.04639880818196, 28.302097099545048], [92.97492395000006, 28.28230580700007], [92.96035119600003, 28.270213521000088], [92.92200728300008, 28.25863800100005], [92.90381717900004, 28.2496979780001], [92.88955448400009, 28.23582285600004], [92.8653699140001, 28.20520457000002], [92.85028039600013, 28.19194956500003], [92.8347774660001, 28.183526306000132], [92.81989465400005, 28.17926300100008], [92.80532190000008, 28.17802276700003], [92.79023238100007, 28.178901266000068], [92.78537479700009, 28.183293762000076], [92.78289432800011, 28.190941874000046], [92.77917362500011, 28.195902812], [92.7700785720001, 28.192182108000097], [92.70786014900011, 28.155414328000106], [92.67861128800007, 28.133064270000105], [92.65484012900009, 28.105830790000127], [92.63727014200003, 28.071982728000123], [92.63892378800006, 28.057487488000092], [92.65422001100012, 28.052087301000128], [92.68925663200014, 28.048314921], [92.70134891800006, 28.037824606000058], [92.70134891800006, 28.025241394000133], [92.73639150917766, 27.98590893651867], [92.71077012957788, 27.949702392409918], [92.68367428669768, 27.910450219011963], [92.63646812873851, 27.89536981004999], [92.59291178341888, 27.868193283595886], [92.57497681769904, 27.847806414432647], [92.51815087726021, 27.839468002981643], [92.47510949800005, 27.846595968000074], [92.43903934800005, 27.823289897000066], [92.42756717900005, 27.82117116400009], [92.41733524600005, 27.828948466], [92.40441613800004, 27.85383066900006], [92.39284061800004, 27.85602691700005], [92.38105839100012, 27.842461853000074], [92.37558068800013, 27.821119487000075], [92.36793257700003, 27.80383372000007], [92.35005253100007, 27.802541809000033], [92.33982059800013, 27.815564270000053], [92.33465295400003, 27.83127390600002], [92.32917525300013, 27.832927552000072], [92.31728967300006, 27.80367869100003], [92.30385380100006, 27.786160380000055], [92.28876428200005, 27.793085022000056], [92.27522505700006, 27.81168853700011], [92.25827518700004, 27.848197937000023], [92.24918013500007, 27.862641500000038], [92.23956831900006, 27.865276998000056], [92.1262935790001, 27.81272206600009], [92.10615954418942, 27.786080717238843], [92.06487820550117, 27.76172129397611], [91.98889765320416, 27.76939841380579], [91.96800093766346, 27.746278233869482], [91.95224735500011, 27.724820455], [91.90873579900006, 27.731900126000127], [91.86491418500009, 27.72998809800002], [91.85637335954294, 27.764539482011514], [91.82658872441321, 27.807627271770244], [91.72987134422583, 27.804136158001306], [91.68013149075769, 27.849823277598603], [91.6283394780001, 27.852693787000035], [91.6371244710001, 27.87724009300011], [91.64890669800008, 27.897213033000057], [91.65283410700005, 27.91674672500004], [91.63795129500011, 27.93974273700009], [91.62172489400012, 27.950723979000074], [91.6006409100001, 27.959276429000013], [91.57862675000007, 27.96470245400009], [91.53749231000012, 27.969353333000058], [91.49749475100003, 27.98408111600004], [91.4609078370001, 27.98436533600004], [91.44643843600005, 27.986354879000075], [91.43648287100012, 27.989375107000015], [91.41884322100009, 27.99472646100004], [91.34143192600004, 28.03056406700007], [91.3095992430001, 28.056402283000082], [91.29016890500003, 28.0914130660001], [91.26970503800004, 28.072861227000075], [91.24614058500003, 28.071465963], [91.2206124270001, 28.07487660700012], [91.19467085800005, 28.07058746400004], [91.17586063600004, 28.057487488000092], [91.13379602000003, 28.01410512300002], [91.11963667900005, 27.994881490000083], [91.11942997200003, 27.99472646100004], [91.09255822800003, 27.97167877200006], [91.05194055200008, 27.96279042600007], [91.00884240800008, 27.966769512000056], [90.97514937400013, 27.982091573], [90.96057662000004, 27.99472646100004], [90.90952030400007, 28.032656963000036], [90.85091923100009, 28.044025777000044], [90.78870080600007, 28.047488098000073], [90.75527753600005, 28.055173215000096], [90.7268957930001, 28.06169911800005], [90.6839010010001, 28.087072245000044], [90.66746789600012, 28.090327860000016], [90.65103479000004, 28.086994731000104], [90.62188928300003, 28.0729645790001], [90.59739465400008, 28.07058746400004], [90.57527714000008, 28.06583323200006], [90.51006148300007, 28.074101461000012], [90.49259484900011, 28.074411519000094], [90.4752315670001, 28.07234446300002], [90.48566935150171, 28.12465735277827], [90.51529856561535, 28.154286566892026], [90.54821991463052, 28.157578701793526], [90.56797272403975, 28.19050005080878], [90.59760193815339, 28.200376455513336], [90.58772553344886, 28.233297804528476], [90.54821991463052, 28.246466344134532], [90.50542216091083, 28.249758479036117], [90.45604013738802, 28.282679828051258], [90.41653451856979, 28.282679828051258], [90.38690530445604, 28.2991405025589], [90.35398395544087, 28.2991405025589], [90.32950402800009, 28.25579579700006], [90.29147017500009, 28.261351014000084], [90.2618041781983, 28.2991405025589], [90.2618041781983, 28.335353986475624], [90.22559069428155, 28.358398930786237], [90.1992536150695, 28.34852252608168], [90.1762086707588, 28.325477581771068], [90.15316372644816, 28.322185446869483], [90.12353451233452, 28.335353986475624], [90.07086035391018, 28.34523039118018], [89.99045495700005, 28.32062388100009], [89.97159305900004, 28.318040060000087], [89.95252445500006, 28.30824737600004], [89.91613001353875, 28.31560117706651], [89.88131433100011, 28.29752451600011], [89.87361454300003, 28.300599263000052], [89.86291752100004, 28.295793356000033], [89.85402917500011, 28.28726674400012], [89.83862959800013, 28.267913921000073], [89.82974125100003, 28.259154765000076], [89.79604821800007, 28.240189515000054], [89.78085534700011, 28.228769023000027], [89.77362064600004, 28.21277516700009], [89.75584395400011, 28.184378967000058], [89.71781010000007, 28.169082744000022], [89.59781742400008, 28.149807434000067], [89.57942061400007, 28.144639791000074], [89.56148889100012, 28.134640401000055], [89.51503177900008, 28.081904602000023], [89.49534305900005, 28.06800364200005], [89.47534428000012, 28.061337382000133], [89.45880782100011, 28.04779815700006], [89.44454512600004, 28.031184184000054], [89.42118737800007, 27.99472646100004], [89.42098067200004, 27.99472646100004], [89.41736367800007, 27.988654027000038], [89.37013106300003, 27.90935699500004], [89.33602461800007, 27.8690752160001], [89.29948938000013, 27.844244690000053], [89.25871667500007, 27.827553203000022], [89.22492028800008, 27.807812806000058], [89.21659020133723, 27.77114152368786], [89.19820315021519, 27.730581852095057], [89.15602109175876, 27.665686377546805], [89.1273589238333, 27.627289888438966], [89.12465494572706, 27.614851589150547], [89.11948401016275, 27.61820054938572], [89.10956515172722, 27.62225826420017], [89.1058645948479, 27.62295211861509], [89.10235143650146, 27.623610835805025], [89.09153086366274, 27.62586512181302], [89.06402857436444, 27.615946263377637], [89.05095371551772, 27.60828169095022], [89.0396822854774, 27.594305117700188], [89.03337028465484, 27.57897597284547], [89.01623771099366, 27.57581997243416], [89.00271199494523, 27.560490827579358], [89.00496628095334, 27.549670254740633], [88.99279313650976, 27.53749711029714], [88.97836570605818, 27.53028339507135], [88.97295541963888, 27.517659393426257], [88.97520970564693, 27.506838820587532], [88.98004625332288, 27.497980380569217], [88.98296649296316, 27.49263177875116], [88.96620182870481, 27.478030296977792], [88.95754909876507, 27.456939267749547], [88.95105955131027, 27.433144260415148], [88.96401118394226, 27.392923642327176], [88.98117510746783, 27.35463488984705], [88.99701872918376, 27.33086945727318], [88.97193299480028, 27.312385231937938], [88.95080816584573, 27.32822885365387], [88.91516001698494, 27.33086945727318], [88.89233077000011, 27.315543111000082], [88.86463220200005, 27.332389628000087], [88.85202315300006, 27.342363180000078], [88.8308358160001, 27.36732289600006], [88.8198287350001, 27.37362742200007], [88.80820153800005, 27.378381653000062], [88.79538578300009, 27.385926412000018], [88.77357832900003, 27.408509013000057], [88.75978072200007, 27.435070699000065], [88.75435469600012, 27.464216207000092], [88.75719689900006, 27.49496368400004], [88.75755863400008, 27.511448466000033], [88.74164229300004, 27.531679789000023], [88.7410221770001, 27.545709941000027], [88.74815352400003, 27.560127666000042], [88.76737715600007, 27.586198425000035], [88.78308679200012, 27.622036031000064], [88.80566939300007, 27.655108948000063], [88.85388350400007, 27.843676249000097], [88.85507206300008, 27.859179179000094], [88.85155806500012, 27.877162577], [88.84277307100012, 27.892407125000133], [88.81889856000004, 27.91519643200003], [88.81068200700014, 27.927857158000066], [88.80975183200007, 27.9444969690001], [88.81967370600006, 27.977337342000013], [88.81771000200013, 27.99472646100004], [88.81771000200013, 27.994881490000083], [88.8175032960001, 27.994881490000083], [88.80293054200013, 28.011004537000062], [88.78014123500003, 28.028341980000064], [88.73564782700004, 28.055265402000074], [88.7101196700001, 28.061983337000115], [88.65203536000013, 28.069398906000018], [88.63167484600007, 28.083351542000017], [88.61048750800012, 28.105830790000127], [88.59400272600004, 28.106605937000026], [88.55281660900005, 28.078054708000067], [88.53080245000007, 28.0590119430001], [88.5171598720001, 28.039581604000105], [88.50207035300008, 28.02888458300002], [88.47540531400011, 28.036248474000033], [88.45576827000008, 28.03152008100004], [88.39990604700012, 27.994881490000083], [88.39985437100012, 27.99472646100004], [88.39975101800007, 27.99472646100004], [88.37877038600004, 27.982634176000047], [88.19785119700003, 27.95829457600003], [88.17485518400008, 27.94976796500002], [88.16296960500006, 27.946899923000032], [88.15118737800003, 27.947209982000018], [88.12669274900009, 27.950439759000105], [88.11573734600012, 27.947261658000045], [88.09992435700008, 27.928322246000093], [88.09749556500003, 27.904008484000073], [88.10488529500003, 27.8797205610001], [88.11821781400005, 27.860884501000058], [88.09573856600008, 27.86532867500007], [88.05279545100012, 27.88651601100004], [88.02995446800008, 27.893337301000074], [88.01812056500006, 27.892148743000078], [87.99181726100005, 27.882640280000075], [87.9784330650001, 27.880521545000093], [87.96639245600011, 27.8827436320001], [87.9452051190001, 27.892303772], [87.93455977400009, 27.895301006000025], [87.85611495000006, 27.898608297000024], [87.83668461200006, 27.908323467000073], [87.82588423700014, 27.906566467000076], [87.81415368700004, 27.890960185000054], [87.79865075700013, 27.863468323000077], [87.77984053500012, 27.839438782000045], [87.75637943500004, 27.82037017900005], [87.72682051600003, 27.807761129000042], [87.70046553600008, 27.80564239500005], [87.67852882500011, 27.813351022000077], [87.65995121300006, 27.819879252000035], [87.63607670100009, 27.82365163200005], [87.62109053600011, 27.81954335600004], [87.58998132300013, 27.804608867000084], [87.57334151200013, 27.805022278000095], [87.56507328300006, 27.810861715000087], [87.55980228700014, 27.819078268000013], [87.5559782310001, 27.827088115], [87.55132735200004, 27.83189402300009], [87.53158695500008, 27.836803284000027], [87.51453373200013, 27.835201314000088], [87.47556970200009, 27.82670054200007], [87.38678959100014, 27.804402161000027], [87.36911625200014, 27.803937073], [87.36911625200014, 27.819078268000013], [87.38069177200009, 27.83582143200006], [87.38534265100003, 27.849412334000064], [87.36384525500011, 27.855251770000038], [87.33583662900008, 27.846363424000018], [87.31392582200004, 27.8285867310001], [87.29051639800008, 27.816081035000096], [87.23289717600005, 27.829723613000013], [87.18199589000011, 27.82450429300009], [87.15579593900009, 27.825796204000042], [87.11652185100013, 27.84458058700004], [87.06200321500012, 27.9084268190001], [87.03053226700013, 27.938089091000037], [87.0056759040001, 27.951499126], [86.98872603400008, 27.952480978000054], [86.98209267100003, 27.950674405000072], [86.97022587100014, 27.947442525], [86.94035689300006, 27.943101705000018], [86.91472538200009, 27.945117086000053], [86.89307295800012, 27.954186300000018], [86.87689823400012, 27.970645243], [86.86816491700012, 27.99472646100004], [86.86816491700012, 27.994881490000083], [86.84046634900011, 28.014776917000077], [86.76997969600006, 28.01208974300006], [86.73980065900014, 28.02149485300002], [86.7322042240001, 28.03495656300008], [86.73597660400003, 28.064851380000093], [86.73173913600004, 28.07691782600007], [86.71768314700006, 28.088260804000058], [86.69964807100013, 28.098751119], [86.68006270300003, 28.105727437], [86.66197595200009, 28.106838481000082], [86.64947025600003 -
yarlung-flow.json 12.8 KB
[ [84.144, 29.565], [84.171, 29.577], [84.22500000000001, 29.559], [84.246, 29.541], [84.297, 29.544], [84.321, 29.532], [84.411, 29.544], [84.426, 29.529], [84.45, 29.535], [84.468, 29.523], [84.492, 29.523], [84.531, 29.490000000000002], [84.507, 29.466], [84.501, 29.445], [84.513, 29.385], [84.495, 29.379], [84.483, 29.361], [84.486, 29.34], [84.519, 29.316], [84.51, 29.292], [84.522, 29.286], [84.525, 29.265], [84.57600000000001, 29.253], [84.58800000000001, 29.259], [84.60300000000001, 29.247], [84.615, 29.265], [84.63, 29.268], [84.624, 29.283], [84.651, 29.286], [84.669, 29.259], [84.732, 29.25], [84.741, 29.235], [84.771, 29.25], [84.777, 29.241], [84.843, 29.223], [84.864, 29.232], [84.879, 29.202], [84.9, 29.199], [84.909, 29.181], [84.933, 29.184], [84.96900000000001, 29.163], [85.023, 29.187], [85.071, 29.259], [85.122, 29.274], [85.167, 29.322], [85.185, 29.310000000000002], [85.26, 29.319], [85.284, 29.301000000000002], [85.34400000000001, 29.289], [85.35600000000001, 29.265], [85.413, 29.262], [85.431, 29.271], [85.449, 29.247], [85.464, 29.244], [85.521, 29.25], [85.551, 29.265], [85.611, 29.235], [85.617, 29.193], [85.662, 29.172], [85.686, 29.172], [85.69500000000001, 29.184], [85.71600000000001, 29.172], [85.72800000000001, 29.187], [85.764, 29.181], [85.761, 29.193], [85.776, 29.202], [85.788, 29.196], [85.797, 29.22], [85.809, 29.211000000000002], [85.848, 29.211000000000002], [85.863, 29.193], [85.881, 29.193], [85.917, 29.172], [85.968, 29.175], [86.004, 29.163], [86.09400000000001, 29.175], [86.10000000000001, 29.166], [86.133, 29.172], [86.148, 29.166], [86.193, 29.178], [86.223, 29.202], [86.268, 29.193], [86.295, 29.208000000000002], [86.34, 29.205000000000002], [86.412, 29.217000000000002], [86.427, 29.211000000000002], [86.43, 29.199], [86.47800000000001, 29.196], [86.496, 29.22], [86.514, 29.211000000000002], [86.52, 29.235], [86.529, 29.238], [86.535, 29.217000000000002], [86.559, 29.196], [86.607, 29.202], [86.616, 29.184], [86.658, 29.193], [86.67, 29.205000000000002], [86.682, 29.199], [86.7, 29.208000000000002], [86.736, 29.205000000000002], [86.778, 29.187], [86.805, 29.196], [86.82300000000001, 29.184], [86.84100000000001, 29.19], [86.901, 29.181], [86.949, 29.163], [87.027, 29.172], [87.039, 29.148], [87.063, 29.136], [87.084, 29.142], [87.12, 29.175], [87.162, 29.142], [87.21000000000001, 29.142], [87.237, 29.157], [87.249, 29.136], [87.297, 29.127], [87.303, 29.115000000000002], [87.366, 29.121000000000002], [87.459, 29.097], [87.486, 29.115000000000002], [87.546, 29.109], [87.56700000000001, 29.121000000000002], [87.59400000000001, 29.121000000000002], [87.60600000000001, 29.133], [87.654, 29.139], [87.666, 29.13], [87.684, 29.133], [87.687, 29.157], [87.669, 29.181], [87.675, 29.205000000000002], [87.705, 29.217000000000002], [87.714, 29.235], [87.732, 29.238], [87.732, 29.253], [87.756, 29.283], [87.753, 29.301000000000002], [87.789, 29.304000000000002], [87.795, 29.328], [87.81, 29.337], [87.849, 29.331], [87.87, 29.349], [87.906, 29.343], [87.924, 29.349], [87.97800000000001, 29.388], [87.996, 29.376], [88.014, 29.379], [88.017, 29.37], [88.125, 29.367], [88.137, 29.337], [88.161, 29.331], [88.176, 29.337], [88.188, 29.325], [88.2, 29.328], [88.221, 29.367], [88.245, 29.367], [88.287, 29.349], [88.299, 29.358], [88.365, 29.316], [88.41, 29.322], [88.422, 29.316], [88.443, 29.325], [88.458, 29.349], [88.503, 29.361], [88.536, 29.334], [88.563, 29.328], [88.596, 29.349], [88.629, 29.346], [88.641, 29.334], [88.671, 29.34], [88.71000000000001, 29.331], [88.72800000000001, 29.343], [88.791, 29.337], [88.818, 29.352], [88.86, 29.319], [88.884, 29.334], [88.908, 29.316], [88.923, 29.331], [88.962, 29.328], [88.971, 29.349], [89.007, 29.361], [89.019, 29.352], [89.034, 29.358], [89.08500000000001, 29.322], [89.136, 29.316], [89.16, 29.343], [89.181, 29.337], [89.211, 29.349], [89.235, 29.379], [89.253, 29.373], [89.265, 29.385], [89.289, 29.385], [89.307, 29.376], [89.349, 29.379], [89.397, 29.358], [89.45100000000001, 29.355], [89.46000000000001, 29.334], [89.58, 29.358], [89.595, 29.346], [89.61, 29.355], [89.631, 29.346], [89.661, 29.349], [89.679, 29.364], [89.757, 29.295], [89.787, 29.292], [89.808, 29.310000000000002], [89.85300000000001, 29.322], [89.931, 29.319], [89.985, 29.343], [90.015, 29.337], [90.072, 29.352], [90.156, 29.355], [90.168, 29.346], [90.20100000000001, 29.349], [90.22500000000001, 29.331], [90.273, 29.337], [90.276, 29.328], [90.342, 29.313], [90.378, 29.295], [90.435, 29.241], [90.477, 29.256], [90.492, 29.25], [90.51, 29.256], [90.522, 29.247], [90.54, 29.262], [90.621, 29.277], [90.642, 29.301000000000002], [90.663, 29.298000000000002], [90.681, 29.313], [90.684, 29.328], [90.705, 29.34], [90.729, 29.328], [90.747, 29.337], [90.765, 29.328], [90.768, 29.310000000000002], [90.756, 29.295], [90.771, 29.277], [90.855, 29.283], [90.897, 29.319], [90.933, 29.310000000000002], [90.95100000000001, 29.295], [90.993, 29.322], [91.035, 29.295], [91.065, 29.316], [91.116, 29.325], [91.131, 29.313], [91.173, 29.325], [91.194, 29.286], [91.233, 29.274], [91.296, 29.289], [91.308, 29.277], [91.34700000000001, 29.28], [91.374, 29.292], [91.395, 29.28], [91.449, 29.286], [91.479, 29.268], [91.512, 29.28], [91.533, 29.271], [91.554, 29.289], [91.587, 29.292], [91.602, 29.271], [91.62, 29.265], [91.659, 29.271], [91.674, 29.259], [91.71000000000001, 29.268], [91.74, 29.259], [91.782, 29.274], [91.839, 29.268], [91.869, 29.283], [91.98, 29.262], [92.007, 29.232], [92.07000000000001, 29.289], [92.115, 29.283], [92.154, 29.289], [92.196, 29.244], [92.22, 29.253], [92.235, 29.244], [92.277, 29.244], [92.295, 29.229], [92.319, 29.226], [92.376, 29.226], [92.397, 29.241], [92.406, 29.262], [92.433, 29.25], [92.46600000000001, 29.253], [92.529, 29.172], [92.529, 29.133], [92.553, 29.148], [92.598, 29.145], [92.589, 29.121000000000002], [92.61, 29.097], [92.619, 29.115000000000002], [92.658, 29.121000000000002], [92.685, 29.139], [92.697, 29.127], [92.676, 29.112000000000002], [92.679, 29.103], [92.709, 29.109], [92.739, 29.067], [92.772, 29.091], [92.775, 29.073], [92.796, 29.082], [92.808, 29.061], [92.82000000000001, 29.067], [92.82300000000001, 29.082], [92.82900000000001, 29.076], [92.85300000000001, 29.082], [92.85600000000001, 29.073], [92.88, 29.073], [92.904, 29.058], [92.934, 29.067], [92.952, 29.049], [92.973, 29.061], [92.988, 29.043], [92.997, 29.049], [93.066, 29.043], [93.081, 29.094], [93.117, 29.115000000000002], [93.123, 29.136], [93.138, 29.139], [93.15, 29.127], [93.147, 29.094], [93.165, 29.064], [93.165, 29.043], [93.153, 29.037], [93.153, 29.025000000000002], [93.162, 29.016000000000002], [93.21300000000001, 29.025000000000002], [93.22800000000001, 29.019000000000002], [93.23100000000001, 29.001], [93.261, 28.992], [93.285, 29.001], [93.312, 28.998], [93.315, 29.016000000000002], [93.348, 29.046], [93.375, 29.052], [93.393, 29.094], [93.429, 29.109], [93.447, 29.106], [93.438, 29.13], [93.48, 29.175], [93.492, 29.163], [93.54, 29.178], [93.57000000000001, 29.166], [93.627, 29.172], [93.63, 29.151], [93.645, 29.145], [93.675, 29.151], [93.681, 29.163], [93.699, 29.16], [93.702, 29.142], [93.735, 29.127], [93.75, 29.136], [93.75, 29.148], [93.78, 29.154], [93.789, 29.124000000000002], [93.825, 29.118000000000002], [93.834, 29.124000000000002], [93.831, 29.142], [93.894, 29.13], [93.912, 29.145], [93.903, 29.166], [93.909, 29.178], [93.94500000000001, 29.184], [93.95400000000001, 29.196], [94.017, 29.193], [94.035, 29.205000000000002], [94.176, 29.196], [94.251, 29.262], [94.305, 29.271], [94.302, 29.292], [94.33200000000001, 29.316], [94.35000000000001, 29.316], [94.389, 29.337], [94.401, 29.361], [94.419, 29.37], [94.434, 29.406000000000002], [94.542, 29.448], [94.581, 29.481], [94.656, 29.490000000000002], [94.70700000000001, 29.463], [94.818, 29.493000000000002], [94.875, 29.541], [94.923, 29.61], [94.926, 29.622], [94.887, 29.634], [94.917, 29.67], [94.893, 29.697], [94.905, 29.715], [94.956, 29.757], [95.124, 29.763], [95.124, 29.781000000000002], [95.09100000000001, 29.814], [95.11200000000001, 29.868000000000002], [95.13, 29.88], [95.175, 29.895], [95.196, 29.892], [95.223, 29.868000000000002], [95.286, 29.868000000000002], [95.304, 29.856], [95.307, 29.838], [95.283, 29.82], [95.289, 29.811], [95.385, 29.772000000000002], [95.379, 29.718], [95.397, 29.688000000000002], [95.388, 29.595], [95.403, 29.562], [95.427, 29.538], [95.43900000000001, 29.478], [95.43, 29.451], [95.313, 29.331], [95.256, 29.289], [95.202, 29.28], [95.04, 29.175], [95.001, 29.169], [95.004, 29.139], [94.908, 29.052], [94.902, 29.016000000000002], [94.869, 28.998], [94.839, 28.956], [94.788, 28.935000000000002], [94.773, 28.854], [94.794, 28.824], [94.914, 28.821], [94.923, 28.812], [94.911, 28.794], [94.92, 28.752], [94.977, 28.713], [94.983, 28.674], [94.998, 28.683], [95.031, 28.617], [95.09700000000001, 28.539], [95.10300000000001, 28.506], [95.09100000000001, 28.455000000000002], [95.09700000000001, 28.419], [95.013, 28.326], [94.992, 28.287], [94.992, 28.242], [95.019, 28.215], [95.031, 28.173000000000002], [95.06700000000001, 28.155], [95.145, 28.149], [95.211, 28.179000000000002], [95.277, 28.155], [95.292, 28.116], [95.316, 28.089000000000002], [95.355, 28.071], [95.379, 28.071], [95.385, 28.059], [95.382, 27.951], [95.4, 27.936], [95.412, 27.882], [95.379, 27.843], [95.349, 27.837], [95.325, 27.810000000000002], [95.325, 27.78], [95.298, 27.762], [95.289, 27.717000000000002], [95.253, 27.657], [95.211, 27.666], [95.151, 27.624000000000002], [95.139, 27.63], [95.10300000000001, 27.609], [94.992, 27.6], [94.944, 27.57], [94.917, 27.573], [94.869, 27.504], [94.803, 27.495], [94.803, 27.48], [94.785, 27.471], [94.794, 27.456], [94.767, 27.435000000000002], [94.767, 27.414], [94.73100000000001, 27.402], [94.71900000000001, 27.372], [94.69800000000001, 27.36], [94.69800000000001, 27.333000000000002], [94.683, 27.324], [94.677, 27.294], [94.635, 27.291], [94.629, 27.273], [94.602, 27.255], [94.596, 27.231], [94.584, 27.228], [94.587, 27.177], [94.596, 27.162], [94.584, 27.147000000000002], [94.566, 27.150000000000002], [94.554, 27.102], [94.518, 27.105], [94.449, 27.060000000000002], [94.44, 27.018], [94.407, 26.985], [94.35900000000001, 26.97], [94.287, 26.919], [94.197, 26.925], [94.164, 26.898], [94.146, 26.865000000000002], [94.125, 26.856], [94.113, 26.868000000000002], [94.134, 26.907], [94.113, 26.913], [94.077, 26.886], [93.927, 26.832], [93.864, 26.766000000000002], [93.753, 26.733], [93.657, 26.715], [93.618, 26.724], [93.56700000000001, 26.751], [93.441, 26.769000000000002], [93.411, 26.76], [93.369, 26.718], [93.288, 26.742], [93.249, 26.724], [93.183, 26.673000000000002], [93.12, 26.646], [93.087, 26.655], [93.018, 26.646], [92.898, 26.655], [92.883, 26.652], [92.874, 26.625], [92.83500000000001, 26.607], [92.733, 26.613], [92.676, 26.601], [92.658, 26.592000000000002], [92.616, 26.523], [92.595, 26.517], [92.508, 26.517], [92.43, 26.535], [92.391, 26.532], [92.244, 26.472], [92.229, 26.442], [92.202, 26.454], [92.172, 26.442], [92.124, 26.403000000000002], [92.06700000000001, 26.373], [92.07000000000001, 26.325], [92.058, 26.304000000000002], [91.971, 26.271], [91.932, 26.271], [91.899, 26.241], [91.878, 26.235], [91.854, 26.241], [91.665, 26.166], [91.608, 26.172], [91.542, 26.145], [91.497, 26.139], [91.377, 26.172], [91.287, 26.166], [91.197, 26.202], [91.134, 26.214000000000002], [91.062, 26.187], [90.96300000000001, 26.175], [90.888, 26.136], [90.849, 26.13], [90.807, 26.154], [90.741, 26.163], [90.681, 26.19], [90.58200000000001, 26.205000000000002], [90.507, 26.229], [90.474, 26.226], [90.435, 26.178], [90.402, 26.16], [90.345, 26.148], [90.309, 26.124], [90.22500000000001, 26.106], [90.177, 26.076], [89.955, 26.01], [89.904, 25.941], [89.84700000000001, 25.89], [89.81400000000001, 25.815], [89.736, 25.692], [89.724, 25.632], [89.697, 25.572], [89.709, 25.482], [89.697, 25.398], [89.67, 25.323], [89.7, 25.266000000000002], [89.703, 25.242], [89.685, 25.2], [89.661, 25.173000000000002], [89.625, 25.074], [89.613, 24.96], [89.613, 24.936], [89.658, 24.87], [89.673, 24.792], [89.706, 24.75], [89.769, 24.549], [89.748, 24.372], [89.754, 24.282], [89.733, 24.225], [89.742, 24.201], [89.739, 24.123], [89.697, 24.015], [89.7, 23.958000000000002], [89.727, 23.883], [89.787, 23.796], [89.85600000000001, 23.748], [89.919, 23.664], [89.985, 23.643], [90.144, 23.544], [90.249, 23.463] ]
-
-
CountryLabel.tsx 1.8 KB · in bundle
-
example-Root.tsx 1 KB · in bundle
-
MapTilerVectorElement.ts 2.1 KB
// Surface an existing MapTiler Planet feature without maintaining duplicate GeoJSON. // Paint animation is deterministic; geometry slicing is not. For a source-to-end line draw, // bake the selected feature to ordered GeoJSON and use RiverReveal.tsx instead. type VectorLayerType = 'fill' | 'line' | 'circle' | 'symbol'; export type MapTilerVectorElement = { id: string; sourceLayer: string; type: VectorLayerType; filter?: unknown[]; minzoom?: number; maxzoom?: number; layout?: Record<string, unknown>; paint: Record<string, unknown>; }; const SOURCE_ID = 'maptiler-planet'; export const addMapTilerVectorElement = ( map: any, apiKey: string, element: MapTilerVectorElement, beforeId?: string, ) => { if (!map.getSource(SOURCE_ID)) { map.addSource(SOURCE_ID, { type: 'vector', url: `https://api.maptiler.com/tiles/v3/tiles.json?key=${apiKey}`, }); } if (map.getLayer(element.id)) return; map.addLayer( { id: element.id, type: element.type, source: SOURCE_ID, 'source-layer': element.sourceLayer, ...(element.filter ? {filter: element.filter} : {}), ...(element.minzoom === undefined ? {} : {minzoom: element.minzoom}), ...(element.maxzoom === undefined ? {} : {maxzoom: element.maxzoom}), ...(element.layout ? {layout: element.layout} : {}), paint: element.paint, }, beforeId, ); }; export const setVectorElementPaint = ( map: any, layerId: string, paint: Record<string, unknown>, ) => { for (const [property, value] of Object.entries(paint)) { map.setPaintProperty(layerId, property, value); } }; // Example: // // addMapTilerVectorElement(map, process.env.REMOTION_MAPTILER_KEY!, { // id: "story-river", // sourceLayer: "waterway", // type: "line", // filter: [ // "all", // ["==", ["get", "class"], "river"], // ["==", ["coalesce", ["get", "name_en"], ["get", "name"]], "Yarlung Tsangpo"], // ], // layout: {"line-cap": "round", "line-join": "round"}, // paint: {"line-color": "#E8F7FF", "line-width": 3, "line-opacity": 0}, // }); // // Per Remotion frame: // setVectorElementPaint(map, "story-river", { // "line-opacity": reveal, // "line-width": 2 + reveal * 2, // }); -
RiverReveal.tsx 10.6 KB · in bundle
-
tokens.ts 1.2 KB
// Example tokens only. Replace every visual value with production-local tokens. export const COLORS = { bg: '#101315', // Electric water — a near-white icy core with a blue glow and a white-hot draw-head (the "electricity" // travels along the river as it draws on). No dark casing. river: '#E8F7FF', // bright icy core riverGlow: 'rgba(73,198,255,0.5)', // electric-blue glow riverHead: '#FFFFFF', // white-hot leading head riverHeadGlow: 'rgba(120,225,255,0.95)', border: '#f5f2ed', // neutral cream country borders/labels over the colored fills cream: '#f5f0eb', } as const; // Example progressive fill tokens. Rename these keys and replace values for each production. export const COUNTRY = { china: '#D4A853', india: '#5B8A8A', bangladesh: '#C07B57', } as const; // Darker shade of each country colour — the settled border line (the bright COUNTRY colour is the // glowing draw-head that leads the animation). export const COUNTRY_DARK = { china: '#9A7530', india: '#3C5C5C', bangladesh: '#855239', } as const; export const FILL_OPACITY = 0.5; export const VIDEO = {width: 1920, height: 1080, fps: 30} as const; // Beat durations (seconds → frames at VIDEO.fps) export const DUR = { mapExplainer: 12 * VIDEO.fps, } as const;
-
-
references
-
map-data-sources.md 4.7 KB
# Map element data sources Choose the source independently for every story element. A single map can—and often should—mix provider vectors with custom geodata. ## Decision rule Use a MapTiler Planet vector layer when the feature already exists there, its attributes support an editorially precise filter, and provider geometry is acceptable for the claim. Use custom GeoJSON when the feature is absent, proposed, historical, disputed, corrected, privately sourced, or needs ordered geometry for a deterministic draw. | Requirement | MapTiler vector layer | Custom GeoJSON | | --------------------------------------------------------------------------- | --------------------- | ------------------------------------------- | | Roads, waterways, water, boundaries, land cover, or other standard context | Prefer | Use only when provider data is insufficient | | Basemap-consistent geometry without a duplicate local dataset | Prefer | No | | Proposed, historical, classified, corrected, or production-specific element | No | Prefer | | Fade, colour, width, radius, blur, or fill-opacity animation | Yes | Yes | | Feature-state highlight when a stable feature ID exists | Yes | Yes | | Deterministic source-to-end line draw or perimeter draw | Bake first | Prefer | | Geometry editing, morphing, clipping, or exact sequencing | No | Prefer | Provider alignment is not proof of correctness. Inspect the attributes and geometry against the editorial source before presenting a provider feature as evidence. ## MapTiler vector mode MapTiler Planet is a vector tile source. Add it once, then build story layers with a `source-layer` and an exact attribute filter. Read the current MapTiler Planet schema before choosing layer names or fields. Common layer categories include `waterway`, `water`, `transportation`, `boundary`, `landcover`, and `poi`; availability, fields, and zoom ranges vary by schema version. ```ts import {addMapTilerVectorElement, setVectorElementPaint} from "./MapTilerVectorElement"; addMapTilerVectorElement(map, process.env.REMOTION_MAPTILER_KEY!, { id: "story-river", sourceLayer: "waterway", type: "line", filter: [ "all", ["==", ["get", "class"], "river"], ["==", ["coalesce", ["get", "name_en"], ["get", "name"]], "Yarlung Tsangpo"], ], layout: {"line-cap": "round", "line-join": "round"}, paint: { "line-color": "#E8F7FF", "line-width": 3, "line-opacity": 0, }, }); setVectorElementPaint(map, "story-river", { "line-opacity": reveal, "line-width": 2 + reveal * 2, }); ``` Animate provider features by changing paint properties from the Remotion frame: opacity, colour, width, blur, fill opacity, circle radius, or symbol opacity. Use feature state only when the source provides stable IDs and the selection remains deterministic across tiles. Do not treat a tiled line as one ordered path. Vector tiles split features at tile boundaries, so a source-to-mouth or start-to-end draw has no reliable global order. If that motion carries meaning, extract and verify the complete feature, order it once, save it as GeoJSON, and use the custom mode. ## Custom geodata mode Use the bundled `../assets/RiverReveal.tsx` and `../scripts/prep-geo.mjs` pattern for custom GeoJSON. This mode owns the exact geometry and can slice it by distance, calculate entry triggers, draw complete borders, and produce deterministic sequences. Custom mode is mandatory when: - the feature is not in the provider dataset; - the story uses a proposed route, planned tunnel, historical boundary, disputed interpretation, or non-public dataset; - provider geometry was editorially corrected; - motion must travel through the geometry in a verified order; - a complete off-screen boundary matters and a viewport query would silently crop it. ## Hybrid mode Use provider vectors for ordinary contextual features and custom GeoJSON for the specific claim. For example: MapTiler waterways and roads as aligned context; a custom proposed tunnel, dam site, disputed boundary, or verified evacuation area as the highlighted evidence. Keep provider and custom layers visually distinct when they carry different evidentiary weight. Record the source and effective date of every custom layer in the production notes. -
map-explainer-architecture.md 6.7 KB
# Map Explainer — architecture reference Deep detail behind `TECHNIQUE.md`: the timing model, the river reveal + electric head, the per-country sequence, and label projection. The supplied values are examples, not a production style system. The custom-geometry example is `../assets/RiverReveal.tsx` + `../assets/CountryLabel.tsx` + `../assets/tokens.ts`. Provider-vector setup is in `../assets/MapTilerVectorElement.ts`; choose between the two modes with `data-sources.md`. ## 1. The render harness (per frame) Init the MapTiler map once (ref guard). On `load`: strip clutter (see `geo-prep.md`), add sources/layers, wait for `once('idle') → continueRender`. Per frame: ``` delayRender → setData/setPaintProperty → map.once('idle', continueRender) → triggerRepaint ``` `preserveDrawingBuffer:true` so Remotion's screenshot captures the canvas. Render `--gl=angle`. For an animated camera, read `render-stability.md`: the MapTiler renderer remains static and a CSS plate transform supplies the camera choreography. ## 2. Timing model — time-based; beat length derived from the sequences Everything keys off **seconds** (`t = frame / fps`), not reveal-units. The river draws over a window; each country **triggers when the river reaches it** and runs a fixed sequence. The beat is exactly as long as the sequences need. ```ts const RIVER_START = 0.3, RIVER_END = 8.0; // river draws over this window const BORDER_S = 2.5, FILL_S = 1.0, LABEL_S = 0.7; // per-country sequence (constant durations) const trigger = (c) => RIVER_START + META[c].stop * (RIVER_END - RIVER_START); // river-arrival time // beat length = max over c of (trigger(c) + BORDER_S + FILL_S + LABEL_S) + tail const reveal = interpolate(t, [RIVER_START, RIVER_END], [0,1], { ...clamp, easing: Easing.bezier(0.645, 0.045, 0.355, 1) }); ``` **Constant durations matter:** drive the border draw by _time since trigger_, not a slice of the reveal — otherwise complex or long borders flash by in a fraction of a second. ## 3. Provider-vector animation MapTiler Planet elements can be animated directly in place. Filter an exact `source-layer` feature, initialize its paint in the hidden or neutral state, then update paint properties from the Remotion frame. This works for line, fill, circle, and symbol layers without copying provider geometry into the project. Do not assume tiled geometry has a global order. Provider features are split at tile boundaries: opacity, colour, width, blur, radius, fill, and feature-state changes are reliable; semantic start-to-end line draws are not. Bake ordered GeoJSON when the direction of the draw carries meaning. ## 4. Custom line animation — reveal + electric draw-head The "electricity" is a **white-hot head** leading the draw — the last few % of the drawn line in its own bright + glow layers, faded out once the river completes. ```ts const riverDrawnKm = lineKm * reveal; map.getSource("river").setData(turf.lineSliceAlong(line, 0, Math.max(0.001, riverDrawnKm))); const headKm = lineKm * 0.03; map.getSource("river-head").setData(turf.lineSliceAlong(line, Math.max(0, riverDrawnKm - headKm), Math.max(0.001, riverDrawnKm))); let headFade = 0; if (reveal > 0.002 && reveal < 0.999) headFade = 1; else if (reveal >= 0.999) headFade = 1 - clamp01((t - RIVER_END) / 0.5); // fade out at the mouth map.setPaintProperty("river-headglow", "line-opacity", 0.85 * headFade); map.setPaintProperty("river-head", "line-opacity", headFade); ``` Layers, bottom→top: `river-glow` (electric blue `#49C6FF`, w11, op0.32, blur6) → `river-line` (icy core `#E8F7FF`, w3) → `river-headglow` (`rgba(120,225,255,.95)`, w16, blur9) → `river-head` (white `#FFFFFF`, w4.5). **No dark casing** — the bright icy core reads over every fill on its own. ## 5. Country animation — border draws → fill blooms → label rises Triggered by river arrival, each country runs three sequential phases. The border is a **darker shade** of the country colour (the electricity is on the river, not here). ```ts const lt = t - trigger(c); // local seconds since trigger // 1) complete source border draws on over a constant BORDER_S, multi-segment-safe const bp = interpolate(clamp01(lt / BORDER_S), [0,1], [0,1], { easing: Easing.bezier(0.645, 0.045, 0.355, 1) }); map.getSource(`trail-${c}`).setData(sliceBorder(DRAW[c], 0, DRAW[c].total * bp)); // COUNTRY_DARK line // 2) fill blooms in (opacity overshoots, then settles) after the border completes const fp = clamp01((lt - BORDER_S) / FILL_S); const fo = interpolate(fp, [0, 0.6, 1], [0, FILL_OPACITY * 1.25, FILL_OPACITY], { ...clamp, easing: Easing.bezier(0.3333333333333333, 1, 0.6666666666666666, 1) }); map.setPaintProperty(`fill-${c}`, "fill-opacity", fp <= 0 ? 0 : fo); // 3) label rises in after the fill const lp = clamp01((lt - BORDER_S - FILL_S) / LABEL_S); ``` `sliceBorder(d, fromKm, toKm)` reveals a portion of a complete (possibly multi-segment) border as a MultiLineString, slicing each segment by cumulative length — no joins across gaps and no viewport crop: ```ts const sliceBorder = (d, fromKm, toKm) => { const out = []; for (let i = 0; i < d.segLines.length; i++) { const start = d.cum[i], end = start + d.segLen[i]; const a = Math.max(fromKm, start), b = Math.min(toKm, end); if (b - a <= 0.0008) continue; out.push(turf.lineSliceAlong(d.segLines[i], a - start, b - start).geometry.coordinates); } return { type:"Feature", properties:{}, geometry:{ type:"MultiLineString", coordinates: out } }; }; ``` Choose fill, border, and river colours in the production's local token file. The bundled token values are examples only; do not carry a source project's palette into another production. ## 6. Labels — HTML overlay, projected each frame Labels are React, not map symbols (full typography control). `CountryLabel` is an example accent-rule, rise-and-fade treatment; select the typeface and final values in the production. Positioned by projecting the anchor to screen pixels **every frame**, stored in state: ```ts const p = map.project(META[c].anchor); // lngLat → screen px (respects the live camera) pos[c] = { x: p.x, y: p.y, reveal: lp }; setLabels(pos); // re-render the overlay; effect deps exclude `labels` ``` `CountryLabel` shows the mechanics: uppercase region name, short accent divider, rise/fade entrance, and `pointerEvents:none`. Select font, weight, size, spacing, contrast, and colour from the production's own type and palette system. ## 7. Camera — fixed map plate for any movement Read `render-stability.md`. Do not use per-frame `map.jumpTo()` for a moving 2D shot; it can shimmer in headless renders even on satellite imagery. Interpolate the intended camera for the CSS plate transform, while keeping the MapTiler renderer static. -
map-geo-prep.md 4 KB
# Map Explainer — basemap & geo prep How the basemap is cleaned and how `../scripts/prep-geo.mjs` bakes the per-country data the component reads. ## Basemap styling — strip the clutter On `load`, remove the basemap's labels and inner admin borders so only your geography reads: ```ts for (const l of m.getStyle().layers as any[]) if (l.type === "symbol" || /other border/i.test(l.id)) m.removeLayer(l.id); ``` - `type === "symbol"` → every place/water/road **label** (the "MapTiler labels"). Gone. - Inner admin-border layer IDs vary by style. Inspect the loaded style, remove state/province/district layers as needed, and retain only the context borders the production requires. - Logo/attribution: `maptilerLogo:false` + `attributionControl:false` aren't always enough — also hide via CSS in the component: ```tsx <style> {` .maplibregl-ctrl-bottom-left, .maplibregl-ctrl-bottom-right, .maplibregl-ctrl-attrib, .maptiler-logo { display: none !important; } `} </style> ``` ## `../scripts/prep-geo.mjs` → outputs Reads a routed river GeoJSON + country polygon GeoJSONs; writes: - **River line** — simplified for a smooth draw. For a braided river, route one source→mouth path through the network first: greedy endpoint-chaining bounces between parallel channels. → `src/geo/river-flow.json`. - **`public/geo/borders.geojson`** — each country's polygon tagged `{country: name}` (one source, filtered per country for the fills). - **`src/geo/country-meta.json`** — per country `{ stop, anchor, border }`. ### `stop` — when a country lights up Walk the river points; first point inside a country (`turf.booleanPointInPolygon`) = the arc-length fraction where the river **enters** it. Drives the trigger time. The headwaters country = 0. ### `anchor` — label centre via pole of inaccessibility The most-interior point of the country (clipped to a per-country **story bbox** so a big country centres in the relevant region, not its far bulge), then a small operator **nudge**. Pole = grid-sample inside the polygon, keep the point with max distance to the boundary. **Centroids get pulled to edges — don't use them.** ```js const pole = (poly) => { const bb = turf.bbox(poly), edge = turf.polygonToLine(poly), N = 46; let best = null, bestD = -1; for (let i = 0; i <= N; i++) for (let j = 0; j <= N; j++) { const p = turf.point([bb[0]+(bb[2]-bb[0])*i/N, bb[1]+(bb[3]-bb[1])*j/N]); if (!turf.booleanPointInPolygon(p, poly)) continue; const d = turf.pointToLineDistance(p, edge); if (d > bestD) { bestD = d; best = p.geometry.coordinates; } } return best; }; const ANCHOR_BBOX = { china:[82,27,96,32], india:[76,14,99,31], bangladesh:[86,20,93,27] }; // story regions const NUDGE = { china:[0,0.6], india:[-1.0,0], bangladesh:[0,-0.6] }; // operator-directed ``` ### `border` — complete source geometry Preserve every exterior ring from the named country source. Never clip a country or bilateral border to the framed bbox and never discard an off-screen segment: the geometry may leave the frame naturally. The renderer handles a MultiLineString by cumulative length, so it remains one timed reveal without inventing joins across gaps. ## Tuning the geo prep for a new scenario | Want | Knob | | --------------------------------- | -------------------------------------------------------------------- | | Which countries | the country list in `prep-geo.mjs` (+ supply their polygon GeoJSONs) | | Label centred in the right region | `ANCHOR_BBOX[country]` (the story bbox) | | Nudge a label | `NUDGE[country]` (lng, lat offset) | | What border is drawn | the complete named source geometry; never the visible extent | | When each lights up | derived from `stop` — depends on the river geometry | -
render-stability.md 3.6 KB
# Moving Map Render Stability Read this reference before building a moving 2D MapTiler scene or diagnosing a wavering Remotion render. ## Symptom and cause If basemap detail shimmers or jitters during a pan/zoom, the likely cause is per-frame `map.jumpTo()`. Headless MapTiler capture can resample both vector hillshade and satellite imagery differently frame to frame. Tile retries, easing changes, and label changes do not solve that renderer effect. ## Required pattern: fixed map plate For any 2D pan/zoom: 1. Render the MapTiler canvas once at the largest required zoom in an oversized container. Size it from the camera route and keep each dimension below the browser's reliable WebGL render-buffer limit (commonly 4096 px). Do **not** blindly use 3×: a 1920×1080 composition becomes 5760 px wide and Chromium may silently downsample it, causing visible pixelation during the CSS zoom. 2. Keep the map's camera static. 3. For each frame, calculate the approved target centre/zoom, then move the canvas with CSS `translate` + `scale`. 4. Apply the same transform to every projected HTML overlay. 5. Continue to animate GeoJSON data and paint properties imperatively; only the renderer camera is frozen. Keep pitch and bearing constant. Use a 3D engine such as Cesium for genuine changing pitch/bearing or a terrain flythrough. ```ts const baseZoom = Math.max(start.zoom, end.zoom); const map = new maptilersdk.Map({ container, style, center: end.center, zoom: baseZoom, pitch: end.pitch ?? 0, bearing: end.bearing ?? 0, interactive: false, fadeDuration: 0, canvasContextAttributes: {preserveDrawingBuffer: true}, }); // Per Remotion frame. `camera` is the approved centre/zoom interpolation. const projected = map.project(camera.center); const scale = 2 ** (camera.zoom - baseZoom); const plate = { transform: `translate(${width / 2 - projected.x * scale}px, ${height / 2 - projected.y * scale}px) scale(${scale})`, transformOrigin: "0 0", }; // Convert label projection with exactly the same plate transform. const labelX = labelPoint.x * scale + width / 2 - projected.x * scale; const labelY = labelPoint.y * scale + height / 2 - projected.y * scale; ``` ### Plate sizing and sharpness - Render at the maximum zoom reached by **any** camera waypoint, including intermediate or hold cameras. The CSS scale should never exceed `1`; otherwise the plate is being enlarged. - Centre the frozen map on the midpoint of the camera route's geographic extent, not automatically on the final camera. This minimizes required overscan. - Keep the largest canvas dimension at or below 4096 px unless the actual render environment has been tested with a larger `MAX_RENDERBUFFER_SIZE`. - For 1920×1080, a 3840×2160 plate is a safe default. For 1080×1920, use approximately 2700×3840 when the route needs extra horizontal pan room. - If the route cannot fit within that plate at the required zoom, split the shot into two fixed plates with a deliberate editorial transition. Do not trade sharpness for one enormous canvas. - Distinguish failure modes: repeating shimmer means the live renderer is moving; steadily soft tiles during a CSS push means the fixed plate is underspecified, internally downsampled, or being scaled above `1`. ## Verification - Render a short MP4, not only a Studio preview. - Inspect static terrain texture and satellite detail while the camera moves. - If any underlying map detail wavers, use the fixed map plate. Do not approve it as a minor preview artefact. - Render WebGL with `--gl=angle`, `preserveDrawingBuffer:true`, and conservative concurrency (`1`) while validating.
-
-
scripts
-
prep-geo.mjs 7.4 KB · in bundle
-
-
TECHNIQUE.md 4.4 KB
# MapTiler maps in Remotion MapTiler is a good solution for map animations where geographics features should be drawn as annotations on top of the map: Country borders, rivers, labels for POIs. ## MapTiler SDK (`@maptiler/sdk`) Draw the basemap plus MapTiler Planet vector layers and custom GeoJSON into a WebGL canvas. Default styled-vector starting point: `MapStyle.BASIC`; satellite is an equally valid choice. ## Remotion Imperatively update `setData`/`setPaintProperty`. Use `jumpTo` only for a static shot, or a fixed map plate for any pan/zoom. Gate with [`delayRender`](https://www.remotion.dev/docs/delay-render.md) until `map.once('idle')`. Use `preserveDrawingBuffer:true`. Render labels as positioned [`<Interactive.Div>`](https://www.remotion.dev/docs/interactive.md) elements. Env `REMOTION_MAPTILER_KEY` (unrestricted). Init the map once (ref guard); update imperatively per frame. When constructing MapLibre/MapTiler layer objects, omit optional properties that are absent. In particular, use `...(layer.filter ? {filter: layer.filter} : {})`; do not pass `filter: undefined`. An undefined filter can suppress the layer while separately created halo or border layers continue rendering, producing missing country fills and dark marker halos with no coloured cores. Drive animation from `useCurrentFrame()` rather than CSS transitions or browser timers. ## Choose the source for each map element Do not begin by manufacturing GeoJSON. First check whether MapTiler Planet already exposes the element as filtered vector data. ### MapTiler vector Use it when the feature exists in a provider `source-layer`, its attributes support an exact filter, and provider geometry is editorially acceptable. ### Hybrid Use it when ordinary geographic context can come from MapTiler while the claim depends on custom evidence. Animate each layer according to its source and meaning. MapTiler vector features remain split across tiles. Do not use them for a semantic start-to-end line draw; extract, verify, order, and bake that element to GeoJSON first. Read **`references/map-data-sources.md`** and reuse **`assets/MapTilerVectorElement.ts`** for provider-layer setup and per-frame paint updates. ## Motion stability **Do not call `map.jumpTo()` on every Remotion frame when the camera moves.** In headless capture it can make both MapTiler hillshade **and satellite imagery** shimmer/jitter, even when the source tiles load correctly. This is renderer resampling, not a data, network, or label problem. For the implementation, read **`references/render-stability.md`** before building or debugging any moving map. It contains the fixed-map-plate recipe, diagnostics, and render checks. - Use the live MapTiler camera only for a static shot. - Keep pitch and bearing constant for a fixed plate. This technique does not implement a genuine changing 3D camera. - Verify the moving preview and a short rendered MP4 before approving a beat. If any basemap detail wavers, switch to the fixed-plate pattern; do not try to solve it with tile retries or camera easing. ## Drawing rivers Use `turf.lineSliceAlong(line, 0, lineKm*reveal)` to draw rivers. ## Source selection Use MapTiler vector layers for suitable provider features and custom GeoJSON for story-specific or ordered geometry. If the beat needs country-entry triggers or a progressive line draw, run `scripts/prep-geo.mjs` to bake `country-meta.json`, `borders.geojson`, and the ordered line. Details → `references/map-data-sources.md` and `references/map-geo-prep.md`. ## Keep it minmal Strip clutter on `load`: remove `symbol` layers (place labels) and `/other border/i` (admin-1 inner borders); hide the logo via CSS. Keep country + disputed borders. ## Files Use as reference: - `assets/RiverReveal.tsx` — the main component. - `assets/MapTilerVectorElement.ts` — filtered MapTiler Planet elements. - `assets/CountryLabel.tsx` — reusable example label. - `assets/tokens.ts` — example palette and durations. - `assets/example-Root.tsx` — minimal composition scaffold. - `assets/sample-data/` — example route and generated country metadata. - `scripts/prep-geo.mjs` — geo pipeline. - `references/map-explainer-architecture.md` — timing model and implementation. - `references/map-data-sources.md` — provider vector versus custom GeoJSON selection. - `references/map-geo-prep.md` — basemap stripping and geo preparation. - `references/render-stability.md` — camera motion and stable headless renders.
-
-
static-map
-
TECHNIQUE.md 1.1 KB
--- name: remotion-maps-static description: Create a deterministic static locator map in Remotion when neither the camera nor geographic data animates. --- # Static map Use a static image when the map only provides location context. This is the smallest, fastest, and most deterministic map technique. ## Build 1. Export or request a map image at the composition's final aspect ratio and at least its rendered pixel dimensions. 2. Store the image in the Remotion project's `public/` directory. 3. Render it with `CanvasImage` and `staticFile()`. 4. Add labels or markers as ordinary Remotion elements if they remain fixed. ```tsx import React from 'react'; import {AbsoluteFill, CanvasImage, staticFile} from 'remotion'; export const StaticMap: React.FC = () => { return ( <> <CanvasImage src={staticFile('locator-map.png')} style={{width: '100%', height: '100%', objectFit: 'cover'}} /> </> ); }; ``` ## Overlays and Interactivity Follow Remotion Interactivity best practices and [Remotion Markup Best practices](../../../SKILL.md) for elements.
-
-
-
REFERENCE.md 1 KB
--- name: remotion-maps description: Remotion Map animation knowledge version: 4.0.520 --- # Remotion Maps Choose exactly one technique from the intended shot, then load only that technique's `TECHNIQUE.md`. Every technique directory is self-contained and may be removed without breaking the others. ## [Static map](techniques/static-map/TECHNIQUE.md) - Requires you grab a satellite image and mount it in a `<Img>` tag, and animate on top ## [Mapbox](techniques/mapbox/TECHNIQUE.md) - Requires a Mapbox key - Nicer styles by default - Map can display a round globe when zoomed out - Includes nice 3D buildings such as the Eiffel tower ## [MapLibre](techniques/maplibre/TECHNIQUE.md) - Requires no API key, fully free - Does not include 3D building ## [MapTiler](techniques/maptiler/TECHNIQUE.md) - Uses MapTiler - Annotations can be drawn on top of geographic features: borders, rivers, labels ## [CesiumJS](techniques/cesium/TECHNIQUE.md) - Flythroughs through terrain and mountains - "Flight simulator" perspective
-
-
3d.md 2.2 KB
--- name: 3d description: 3D content in Remotion using Three.js and React Three Fiber. metadata: tags: 3d, three, threejs --- # Using Three.js and React Three Fiber in Remotion Follow React Three Fiber and Three.js best practices. Only the following Remotion-specific rules need to be followed: ## Prerequisites First, the `@remotion/three` package needs to be installed. If it is not, use the following command: ```bash npx remotion add @remotion/three # If project uses npm bunx remotion add @remotion/three # If project uses bun yarn remotion add @remotion/three # If project uses yarn pnpm exec remotion add @remotion/three # If project uses pnpm ``` ## Using ThreeCanvas You MUST wrap 3D content in `<ThreeCanvas>` and include proper lighting. `<ThreeCanvas>` MUST have a `width` and `height` prop. ```tsx import { ThreeCanvas } from "@remotion/three"; import { useVideoConfig } from "remotion"; const { width, height } = useVideoConfig(); <ThreeCanvas width={width} height={height}> <ambientLight intensity={0.4} /> <directionalLight position={[5, 5, 5]} intensity={0.8} /> <mesh> <sphereGeometry args={[1, 32, 32]} /> <meshStandardMaterial color="red" /> </mesh> </ThreeCanvas>; ``` ## No animations not driven by `useCurrentFrame()` Shaders, models etc MUST NOT animate by themselves. No animations are allowed unless they are driven by `useCurrentFrame()`. Otherwise, it will cause flickering during rendering. Using `useFrame()` from `@react-three/fiber` is forbidden. ## Animate using `useCurrentFrame()` Use `useCurrentFrame()` to perform animations. ```tsx const frame = useCurrentFrame(); const rotationY = frame * 0.02; <mesh rotation={[0, rotationY, 0]}> <boxGeometry args={[2, 2, 2]} /> <meshStandardMaterial color="#4a9eff" /> </mesh>; ``` ## Using `<Sequence>` inside `<ThreeCanvas>` The `layout` prop of any `<Sequence>` inside a `<ThreeCanvas>` must be set to `none`. ```tsx import { Sequence } from "remotion"; import { ThreeCanvas } from "@remotion/three"; const { width, height } = useVideoConfig(); <ThreeCanvas width={width} height={height}> <Sequence layout="none"> <mesh> <boxGeometry args={[2, 2, 2]} /> <meshStandardMaterial color="#4a9eff" /> </mesh> </Sequence> </ThreeCanvas>; ``` -
audio-visualization.md 4.8 KB
--- name: audio-visualization description: Audio visualization patterns - spectrum bars, waveforms, bass-reactive effects metadata: tags: audio, visualization, spectrum, waveform, bass, music, audiogram, frequency --- # Audio Visualization in Remotion ## Prerequisites ```bash npx remotion add @remotion/media-utils ``` ## Loading Audio Data Use `useWindowedAudioData()` (https://www.remotion.dev/docs/use-windowed-audio-data) to load audio data: ```tsx import { useWindowedAudioData } from "@remotion/media-utils"; import { staticFile, useCurrentFrame, useVideoConfig } from "remotion"; const frame = useCurrentFrame(); const { fps } = useVideoConfig(); const { audioData, dataOffsetInSeconds } = useWindowedAudioData({ src: staticFile("podcast.wav"), frame, fps, windowInSeconds: 30, }); ``` ## Spectrum Bar Visualization Use `visualizeAudio()` (https://www.remotion.dev/docs/visualize-audio) to get frequency data for bar charts: ```tsx import { useWindowedAudioData, visualizeAudio } from "@remotion/media-utils"; import { staticFile, useCurrentFrame, useVideoConfig } from "remotion"; const frame = useCurrentFrame(); const { fps } = useVideoConfig(); const { audioData, dataOffsetInSeconds } = useWindowedAudioData({ src: staticFile("music.mp3"), frame, fps, windowInSeconds: 30, }); if (!audioData) { return null; } const frequencies = visualizeAudio({ fps, frame, audioData, numberOfSamples: 256, optimizeFor: "speed", dataOffsetInSeconds, }); return ( <div style={{ display: "flex", alignItems: "flex-end", height: 200 }}> {frequencies.map((v, i) => ( <div key={i} style={{ flex: 1, height: `${v * 100}%`, backgroundColor: "#0b84f3", margin: "0 1px", }} /> ))} </div> ); ``` - `numberOfSamples` must be power of 2 (32, 64, 128, 256, 512, 1024) - Values range 0-1; left of array = bass, right = highs - Use `optimizeFor: "speed"` for Lambda or high sample counts **Important:** When passing `audioData` to child components, also pass the `frame` from the parent. Do not call `useCurrentFrame()` in each child - this causes discontinuous visualization when children are inside `<Sequence>` with offsets. ## Waveform Visualization Use `visualizeAudioWaveform()` (https://www.remotion.dev/docs/media-utils/visualize-audio-waveform) with `createSmoothSvgPath()` (https://www.remotion.dev/docs/media-utils/create-smooth-svg-path) for oscilloscope-style displays: ```tsx import { createSmoothSvgPath, useWindowedAudioData, visualizeAudioWaveform, } from "@remotion/media-utils"; import { staticFile, useCurrentFrame, useVideoConfig } from "remotion"; const frame = useCurrentFrame(); const { width, fps } = useVideoConfig(); const HEIGHT = 200; const { audioData, dataOffsetInSeconds } = useWindowedAudioData({ src: staticFile("voice.wav"), frame, fps, windowInSeconds: 30, }); if (!audioData) { return null; } const waveform = visualizeAudioWaveform({ fps, frame, audioData, numberOfSamples: 256, windowInSeconds: 0.5, dataOffsetInSeconds, }); const path = createSmoothSvgPath({ points: waveform.map((y, i) => ({ x: (i / (waveform.length - 1)) * width, y: HEIGHT / 2 + (y * HEIGHT) / 2, })), }); return ( <svg width={width} height={HEIGHT}> <path d={path} fill="none" stroke="#0b84f3" strokeWidth={2} /> </svg> ); ``` ## Bass-Reactive Effects Extract low frequencies for beat-reactive animations: ```tsx const frequencies = visualizeAudio({ fps, frame, audioData, numberOfSamples: 128, optimizeFor: "speed", dataOffsetInSeconds, }); const lowFrequencies = frequencies.slice(0, 32); const bassIntensity = lowFrequencies.reduce((sum, v) => sum + v, 0) / lowFrequencies.length; const scale = 1 + bassIntensity * 0.5; const opacity = Math.min(0.6, bassIntensity * 0.8); ``` ## Volume-Based Waveform Use `getWaveformPortion()` (https://www.remotion.dev/docs/get-waveform-portion) when you need simplified volume data instead of frequency spectrum: ```tsx import { getWaveformPortion } from "@remotion/media-utils"; import { useCurrentFrame, useVideoConfig } from "remotion"; const frame = useCurrentFrame(); const { fps } = useVideoConfig(); const currentTimeInSeconds = frame / fps; const waveform = getWaveformPortion({ audioData, startTimeInSeconds: currentTimeInSeconds, durationInSeconds: 5, numberOfSamples: 50, }); // Returns array of { index, amplitude } objects (amplitude: 0-1) waveform.map((bar) => ( <div key={bar.index} style={{ height: bar.amplitude * 100 }} /> )); ``` ## Postprocessing Low frequencies naturally dominate. Apply logarithmic scaling for visual balance: ```tsx const minDb = -100; const maxDb = -30; const scaled = frequencies.map((value) => { const db = 20 * Math.log10(value); return (db - minDb) / (maxDb - minDb); }); ``` -
audio.md 3.5 KB
--- name: audio description: Using audio and sound in Remotion - importing, trimming, volume, speed, pitch metadata: tags: audio, media, trim, volume, speed, loop, pitch, mute, sound, sfx --- # Using audio in Remotion ## Prerequisites First, the @remotion/media package needs to be installed. If it is not installed, use the following command: ```bash npx remotion add @remotion/media ``` ## Importing Audio Use `<Audio>` from `@remotion/media` to add audio to your composition. ```tsx import { Audio } from "@remotion/media"; import { staticFile } from "remotion"; export const MyComposition = () => { return <Audio src={staticFile("audio.mp3")} />; }; ``` Remote URLs are also supported: ```tsx <Audio src="https://remotion.media/audio.mp3" /> ``` By default, audio plays from the start, at full volume and full length. Multiple audio tracks can be layered by adding multiple `<Audio>` components. ## Trimming Use `trimBefore` and `trimAfter` to remove portions of the audio. Values are in frames. ```tsx const { fps } = useVideoConfig(); return ( <Audio src={staticFile("audio.mp3")} trimBefore={2 * fps} // Skip the first 2 seconds trimAfter={10 * fps} // End at the 10 second mark /> ); ``` The audio still starts playing at the beginning of the composition - only the specified portion is played. ## Delaying Wrap the audio in a `<Sequence>` to delay when it starts: ```tsx import { Sequence, staticFile } from "remotion"; import { Audio } from "@remotion/media"; const { fps } = useVideoConfig(); return ( <Sequence from={1 * fps}> <Audio src={staticFile("audio.mp3")} /> </Sequence> ); ``` The audio will start playing after 1 second. ## Volume Set a static volume (0 to 1): ```tsx <Audio src={staticFile("audio.mp3")} volume={0.5} /> ``` Or use a callback for dynamic volume based on the current frame: ```tsx import { interpolate } from "remotion"; const { fps } = useVideoConfig(); return ( <Audio src={staticFile("audio.mp3")} volume={(f) => interpolate(f, [0, 1 * fps], [0, 1], { extrapolateRight: "clamp" }) } /> ); ``` The value of `f` starts at 0 when the audio begins to play, not the composition frame. ## Muting Use `muted` to silence the audio. It can be set dynamically: ```tsx const frame = useCurrentFrame(); const { fps } = useVideoConfig(); return ( <Audio src={staticFile("audio.mp3")} muted={frame >= 2 * fps && frame <= 4 * fps} // Mute between 2s and 4s /> ); ``` ## Speed Use `playbackRate` to change the playback speed: ```tsx // 2x speed <Audio src={staticFile("audio.mp3")} playbackRate={2} /> // Half speed <Audio src={staticFile("audio.mp3")} playbackRate={0.5} /> ``` Reverse playback is not supported. ## Looping Use `loop` to loop the audio indefinitely: ```tsx <Audio src={staticFile("audio.mp3")} loop /> ``` Use `loopVolumeCurveBehavior` to control how the frame count behaves when looping: - `"repeat"`: Frame count resets to 0 each loop (default) - `"extend"`: Frame count continues incrementing ```tsx <Audio src={staticFile("audio.mp3")} loop loopVolumeCurveBehavior="extend" volume={(f) => interpolate(f, [0, 300], [1, 0])} // Fade out over multiple loops /> ``` ## Pitch Use `toneFrequency` to adjust the pitch without affecting speed. Values range from 0.01 to 2: ```tsx <Audio src={staticFile("audio.mp3")} toneFrequency={1.5} // Higher pitch /> <Audio src={staticFile("audio.mp3")} toneFrequency={0.8} // Lower pitch /> ``` Pitch shifting only works during server-side rendering, not in the Remotion Studio preview or in the `<Player />`. -
calculate-metadata.md 3.3 KB
--- name: calculate-metadata description: Dynamically set composition duration, dimensions, and props metadata: tags: calculateMetadata, duration, dimensions, props, dynamic --- # Using calculateMetadata Use `calculateMetadata` on a `<Composition>` to dynamically set duration, dimensions, and transform props before rendering. Use it when metadata depends on input props, fetched data, or asset metadata. For static dimensions, duration, FPS, and initial props, inline the values on `<Composition>` instead. ```tsx <Composition id="MyComp" component={MyComponent} durationInFrames={300} fps={30} width={1920} height={1080} defaultProps={{ videoSrc: "https://remotion.media/video.mp4" }} calculateMetadata={calculateMetadata} /> ``` ## Setting duration based on a video Use the `getVideoDuration` and `getVideoDimensions` skills to get the video duration and dimensions: ```tsx import { CalculateMetadataFunction } from "remotion"; import { getVideoDuration } from "./get-video-duration"; const calculateMetadata: CalculateMetadataFunction<Props> = async ({ props, }) => { const durationInSeconds = await getVideoDuration(props.videoSrc); return { durationInFrames: Math.ceil(durationInSeconds * 30), }; }; ``` ## Matching dimensions of a video Use the `getVideoDimensions` skill to get the video dimensions: ```tsx import { CalculateMetadataFunction } from "remotion"; import { getVideoDuration } from "./get-video-duration"; import { getVideoDimensions } from "./get-video-dimensions"; const calculateMetadata: CalculateMetadataFunction<Props> = async ({ props, }) => { const dimensions = await getVideoDimensions(props.videoSrc); return { width: dimensions.width, height: dimensions.height, }; }; ``` ## Setting duration based on multiple videos ```tsx const calculateMetadata: CalculateMetadataFunction<Props> = async ({ props, }) => { const metadataPromises = props.videos.map((video) => getVideoDuration(video.src), ); const allMetadata = await Promise.all(metadataPromises); const totalDuration = allMetadata.reduce( (sum, durationInSeconds) => sum + durationInSeconds, 0, ); return { durationInFrames: Math.ceil(totalDuration * 30), }; }; ``` ## Setting a default outName Set the default output filename based on props: ```tsx const calculateMetadata: CalculateMetadataFunction<Props> = async ({ props, }) => { return { defaultOutName: `video-${props.id}`, // .mp4 is added automatically }; }; ``` ## Transforming props Fetch data or transform props before rendering: ```tsx const calculateMetadata: CalculateMetadataFunction<Props> = async ({ props, abortSignal, }) => { const response = await fetch(props.dataUrl, { signal: abortSignal }); const data = await response.json(); return { props: { ...props, fetchedData: data, }, }; }; ``` The `abortSignal` cancels stale requests when props change in the Studio. ## Return value All fields are optional. Returned values override the `<Composition>` props: - `durationInFrames`: Number of frames - `width`: Composition width in pixels - `height`: Composition height in pixels - `fps`: Frames per second - `props`: Transformed props passed to the component - `defaultOutName`: Default output filename - `defaultCodec`: Default codec for rendering -
compositions.md 3.1 KB
--- name: compositions description: Defining compositions, stills, folders, default props and dynamic metadata metadata: tags: composition, still, folder, props, metadata --- A `<Composition>` defines the component, width, height, fps and duration of a renderable video. ## Default Props and scaffold metadata Pass `defaultProps` to provide initial values for your component. Values must be JSON-serializable (`Date`, `Map`, `Set`, and `staticFile()` are supported). Use `defaultProps` for composition-wide values that should be visible and editable before the video renders. For Studio editing, keep `defaultProps` as an inline object literal on `<Composition>` or `<Still>`. Do not store it in a variable, import it, spread it, create it with a helper, or wrap it in `satisfies`. When scaffolding, keep the component and `<Composition>` registration in the same file so `width`, `height`, `fps`, `durationInFrames`, and `defaultProps` are visible next to the code that uses them. Use `type` declarations for props rather than `interface` to ensure `defaultProps` type safety. ```tsx type Props = { readonly title: string; }; export const MyComposition = ({ title }: Props) => ( <h1> {title} </h1> ); const defaultProps = { title: "Hello World" }; // 👍 Inline metadata and defaults <Composition id="MyComposition" component={MyComposition} durationInFrames={100} fps={30} width={1080} height={1080} defaultProps={{ title: "Hello World" }} />; // 👎 Hidden defaults cannot be saved back by Studio <Composition id="OtherComposition" component={MyComposition} durationInFrames={100} fps={30} width={1080} height={1080} defaultProps={defaultProps} />; ``` ## Folders Use `<Folder>` to organize compositions in the sidebar. Folder names can only contain letters, numbers, and hyphens. ```tsx import { Composition, Folder } from "remotion"; export const RemotionRoot = () => { return ( <> <Folder name="Marketing"> <Composition id="Promo" /* ... */ /> <Composition id="Ad" /* ... */ /> </Folder> <Folder name="Social"> <Folder name="Instagram"> <Composition id="Story" /* ... */ /> <Composition id="Reel" /* ... */ /> </Folder> </Folder> </> ); }; ``` ## Stills Use `<Still>` for single-frame images. It does not require `durationInFrames` or `fps`. ```tsx import { Still } from "remotion"; import { Thumbnail } from "./Thumbnail"; export const RemotionRoot = () => { return ( <Still id="Thumbnail" component={Thumbnail} width={1280} height={720} /> ); }; ``` ## Dynamic duration, width, and height Use [`calculateMetadata`](./calculate-metadata.md) to make dimensions, duration, or props dynamic based on input props, fetched data, or asset metadata. ## Nesting compositions within another To add a composition within another composition, you can use the `<Sequence>` component with a `width` and `height` prop to specify the size of the composition. ```tsx <AbsoluteFill> <Sequence width={COMPOSITION_WIDTH} height={COMPOSITION_HEIGHT}> <CompositionComponent /> </Sequence> </AbsoluteFill> ``` -
cropping.md 1 KB
# Cropping Preferably, the `cropLeft`, `cropRight`, `cropTop` and `cropBottom` props are used to crop content. It allows for interactively dragging the components and adapting the outlines in the canvas to the crop. The following components support `crop*` props: - `<Sequence>` from `remotion`, when `layout="absolute-fill"` - `<CanvasImage>` from `remotion` - `<Img>` from `remotion` - `<AnimatedImage>` from `remotion` - `<HtmlInCanvas>` from `remotion` - `<Solid>` from `remotion` - `<Video>` from `@remotion/media` - `<Gif>` from `@remotion/gif` - `<RemotionRiveCanvas>` from `@remotion/rive` Crop values are ratios between `0` and `1`. A value of `0` applies no crop on that edge. A value of `1` is a full crop. Keep Interactivity Best Practices also for cropping, to keep it editable and keyframable. ```tsx <CanvasImage src={staticFile("photo.png")} cropLeft={interpolate(frame, [0, 30], [0, 0.25], { extrapolateLeft: "clamp", extrapolateRight: "clamp", })} cropBottom={0.1} /> ``` Do not use `clipPath` together with crop props. -
effects.md 8.7 KB
--- name: effects description: Canvas/WebGL visual effects for Remotion using effects arrays and createEffect(). metadata: tags: effects, visual-effects, webgl, canvas, video, create-effect --- Use this rule only when the top-level skill lists an effect that matches the requested look, or when the user asks to create a reusable custom effect. Docs: https://www.remotion.dev/docs/effects Custom effect docs: https://www.remotion.dev/docs/create-effect ## Usage Install the package that provides the chosen effect: ```bash npx remotion add @remotion/effects ``` Effects are functions passed to the `effects` prop of canvas-based components such as `<Video>` from `@remotion/media`, `<Solid>`, `<CanvasImage>`, and `<HtmlInCanvas>`. ```tsx import {Video} from '@remotion/media'; import {blur} from '@remotion/effects/blur'; <Video src="https://remotion.media/video.mp4" effects={[blur({radius: 8})]} />; ``` Use the effect docs for exact props and imports. Most `@remotion/effects` imports use `@remotion/effects/<effect-slug>`; `uvTranslate()` and `xyTranslate()` use `@remotion/effects/translate`. These effects use WebGL2. During renders, enable WebGL with: ```ts import {Config} from '@remotion/cli/config'; Config.setChromiumOpenGlRenderer('angle'); ``` ## Available effects `brightness()`, `contrast()`, `colorKey()`, `duotone()`, `grayscale()`, `hue()`, `invert()`, `saturation()`, `tint()`, `linearGradient()`, `linearGradientTint()`, `thermalVision()`, `blur()`, `linearProgressiveBlur()`, `radialProgressiveBlur()`, `zoomBlur()`, `dropShadow()`, `glow()`, `lightTrail()`, `evolve()`, `venetianBlinds()`, `mirror()`, `scale()`, `uvTranslate()`, `xyTranslate()`, `barrelDistortion()`, `chromaticAberration()`, `fisheye()`, `cornerPin()`, `wave()`, `burlap()`, `emboss()`, `dotGrid()`, `halftone()`, `noise()`, `noiseDisplacement()`, `paper()`, `roughenEdges()`, `pattern()`, `pixelate()`, `pixelDissolve()`, `scanlines()`, `speckle()`, `shine()`, `shrinkwrap()`, `vignette()`, `contourLines()`, `checkerboard()`, `halftoneLinearGradient()`, `gridlines()`, `whiteNoise()`, `tvSignalOff()`, `lines()`, `rings()`, `waves()`, `zigzag()`, `lightLeak()`, `starburst()`. Example: ```tsx import {brightness} from "@remotion/effects"; <Video src="https://remotion.media/video.mp4" effects={[brightness({})]} />; ``` ## Custom effects Use `createEffect()` from `remotion` when the user wants a reusable effect factory that works in the same `effects` array as `@remotion/effects`. Prefer a custom effect over `<HtmlInCanvas onPaint>` when the transformation should be reusable, parameterized, editable in Studio, or stackable with other effects. For quick project-specific effects, keep the effect next to the composition, for example `src/effects/palette-map.ts`. For library effects intended for `@remotion/effects`, follow the repository's `add-effect` skill instead. `createEffect()` expects: - `type`: stable reverse-DNS identifier, for example `com.example.paletteMap`. - `label`: Studio label, commonly `paletteMap()`. - `documentationLink`: URL or `null`. - `backend`: `"2d"`, `"webgl2"` or `"webgpu"`. - `calculateKey(params)`: stable string containing every resolved parameter that changes output. - `setup(target)`: create reusable backend state, or return `null`. - `apply({source, target, width, height, params, state, flipSourceY})`: draw the transformed result into `target`. - `cleanup(state)`: free resources created by `setup()`. - `schema`: an `InteractivitySchema` for Studio controls. `disabled` is added automatically. - `validateParams(params)`: throw on missing or invalid values. Use `backend: "2d"` for simple pixel, filter, drawImage, or image-data effects. Use WebGL2 only when shader math or GPU performance is needed; during renders, enable WebGL as shown above. ```ts import {createEffect, type InteractivitySchema} from 'remotion'; type MyEffectParams = { readonly amount?: number; }; const myEffectSchema = { amount: { type: 'number', min: 0, max: 1, step: 0.01, default: 1, description: 'Amount', }, } as const satisfies InteractivitySchema; const resolve = (params: MyEffectParams) => ({ amount: params.amount ?? 1, }); export const myEffect = createEffect<MyEffectParams, null>({ type: 'com.example.myEffect', label: 'myEffect()', documentationLink: null, backend: '2d', calculateKey: (params) => { const {amount} = resolve(params); return `my-effect-${amount}`; }, setup: () => null, apply: ({source, target, width, height, params}) => { const ctx = target.getContext('2d'); if (!ctx) { throw new Error('Could not get a 2D context for myEffect().'); } const {amount} = resolve(params); ctx.clearRect(0, 0, width, height); ctx.filter = `opacity(${amount * 100}%)`; ctx.drawImage(source, 0, 0, width, height); ctx.filter = 'none'; }, cleanup: () => undefined, schema: myEffectSchema, validateParams: ({amount = 1}) => { if (typeof amount !== 'number' || !Number.isFinite(amount) || amount < 0 || amount > 1) { throw new TypeError('amount must be a number between 0 and 1'); } }, }); ``` For a WebGL2 effect, compile/link shaders in `setup()`, keep the program, fullscreen quad, texture, and uniform locations in state, upload `source` in `apply()`, and free GPU resources in `cleanup()`. Minimal shape: ```ts import {createEffect, type InteractivitySchema} from 'remotion'; type RgbShiftParams = { readonly amount?: number; }; type RgbShiftState = { readonly gl: WebGL2RenderingContext; readonly program: WebGLProgram; readonly vao: WebGLVertexArrayObject; readonly vbo: WebGLBuffer; readonly texture: WebGLTexture; readonly uSource: WebGLUniformLocation | null; readonly uOffset: WebGLUniformLocation | null; }; const rgbShiftSchema = { amount: { type: 'number', min: 0, max: 80, step: 1, default: 12, description: 'Amount', }, } as const satisfies InteractivitySchema; export const rgbShift = createEffect<RgbShiftParams, RgbShiftState>({ type: 'com.example.rgbShift', label: 'rgbShift()', documentationLink: null, backend: 'webgl2', calculateKey: ({amount = 12}) => `rgb-shift-${amount}`, setup: (target) => { const gl = target.getContext('webgl2', { premultipliedAlpha: true, alpha: true, preserveDrawingBuffer: true, }); if (!gl) { throw new Error('Could not get a WebGL2 context for rgbShift().'); } gl.pixelStorei(gl.UNPACK_PREMULTIPLY_ALPHA_WEBGL, true); // Compile/link shaders, create a fullscreen quad VAO/VBO, create a // CLAMP_TO_EDGE RGBA texture, and get uSource/uOffset uniform locations. return createRgbShiftState(gl); }, apply: ({source, width, height, params, state, flipSourceY}) => { const amount = params.amount ?? 12; const {gl} = state; gl.viewport(0, 0, width, height); gl.pixelStorei(gl.UNPACK_FLIP_Y_WEBGL, flipSourceY); gl.activeTexture(gl.TEXTURE0); gl.bindTexture(gl.TEXTURE_2D, state.texture); gl.texImage2D( gl.TEXTURE_2D, 0, gl.RGBA, gl.RGBA, gl.UNSIGNED_BYTE, source as TexImageSource, ); gl.bindFramebuffer(gl.FRAMEBUFFER, null); gl.useProgram(state.program); if (state.uSource) gl.uniform1i(state.uSource, 0); if (state.uOffset) gl.uniform2f(state.uOffset, amount / width, 0); gl.bindVertexArray(state.vao); gl.drawArrays(gl.TRIANGLE_STRIP, 0, 4); }, cleanup: ({gl, program, vao, vbo, texture}) => { gl.deleteTexture(texture); gl.deleteBuffer(vbo); gl.deleteProgram(program); gl.deleteVertexArray(vao); }, schema: rgbShiftSchema, validateParams: ({amount = 12}) => { if (typeof amount !== 'number' || !Number.isFinite(amount) || amount < 0 || amount > 80) { throw new TypeError('amount must be a number between 0 and 80'); } }, }); ``` For a complete 2D and WebGL2 pair, see `packages/example/src/EffectsTestbed/sample-posterize-2d.ts` and `packages/example/src/EffectsTestbed/sample-rgb-shift-webgl.ts`. Use the returned factory in an `effects` array: ```tsx import {CanvasImage, staticFile} from 'remotion'; import {myEffect} from './effects/my-effect'; export const MyComp: React.FC = () => { return ( <CanvasImage src={staticFile('image.png')} effects={[myEffect({amount: 0.8})]} /> ); }; ``` When generating a custom effect, also: - Include `disabled?: boolean` only through the returned factory; do not add it to the custom params type or schema. - Validate required parameters at factory-call time with `validateParams`. - Include all defaults in both `schema` and the `resolve()` helper. - Reset mutable 2D context state such as `filter`, `globalAlpha`, transforms, and compositing after drawing. - Preserve alpha unless the requested effect intentionally changes transparency. -
embedding-videos.md 3.4 KB
--- name: embedding-videos description: Embedding videos in Remotion - trimming, volume, speed, looping, pitch metadata: tags: video, media, trim, volume, speed, loop, pitch --- # Using videos in Remotion ## Prerequisites First, the @remotion/media package needs to be installed. If it is not, use the following command: ```bash npx remotion add @remotion/media # If project uses npm bunx remotion add @remotion/media # If project uses bun yarn remotion add @remotion/media # If project uses yarn pnpm exec remotion add @remotion/media # If project uses pnpm ``` Use `<Video>` from `@remotion/media` to embed videos into your composition. ```tsx import { Video } from "@remotion/media"; import { staticFile } from "remotion"; export const MyComposition = () => { return <Video src={staticFile("video.mp4")} />; }; ``` Remote URLs are also supported: ```tsx <Video src="https://remotion.media/video.mp4" /> ``` ## Trimming Use `trimBefore` and `trimAfter` to remove portions of the video. Values are in seconds. ```tsx const { fps } = useVideoConfig(); return ( <Video src={staticFile("video.mp4")} trimBefore={2 * fps} // Skip the first 2 seconds trimAfter={10 * fps} // End at the 10 second mark /> ); ``` ## Delaying Wrap the video in a `<Sequence>` to delay when it appears: ```tsx import { Sequence, staticFile } from "remotion"; import { Video } from "@remotion/media"; const { fps } = useVideoConfig(); return ( <Sequence from={1 * fps}> <Video src={staticFile("video.mp4")} /> </Sequence> ); ``` The video will appear after 1 second. ## Sizing and Position Use the `style` prop to control size and position: ```tsx <Video src={staticFile("video.mp4")} style={{ width: 500, height: 300, position: "absolute", top: 100, left: 50, }} objectFit="cover" /> ``` ## Volume Set a static volume (0 to 1): ```tsx <Video src={staticFile("video.mp4")} volume={0.5} /> ``` Or use a callback for dynamic volume based on the current frame: ```tsx import { interpolate } from "remotion"; const { fps } = useVideoConfig(); return ( <Video src={staticFile("video.mp4")} volume={(f) => interpolate(f, [0, 1 * fps], [0, 1], { extrapolateRight: "clamp" }) } /> ); ``` Use `muted` to silence the video entirely: ```tsx <Video src={staticFile("video.mp4")} muted /> ``` ## Speed Use `playbackRate` to change the playback speed: ```tsx // 2x speed <Video src={staticFile("video.mp4")} playbackRate={2} /> // Half speed <Video src={staticFile("video.mp4")} playbackRate={0.5} /> ``` Reverse playback is not supported. ## Looping Use `loop` to loop the video indefinitely: ```tsx <Video src={staticFile("video.mp4")} loop /> ``` Use `loopVolumeCurveBehavior` to control how the frame count behaves when looping: - `"repeat"`: Frame count resets to 0 each loop (for `volume` callback) - `"extend"`: Frame count continues incrementing ```tsx <Video src={staticFile("video.mp4")} loop loopVolumeCurveBehavior="extend" volume={(f) => interpolate(f, [0, 300], [1, 0])} // Fade out over multiple loops /> ``` ## Pitch Use `toneFrequency` to adjust the pitch without affecting speed. Values range from 0.01 to 2: ```tsx <Video src={staticFile("video.mp4")} toneFrequency={1.5} // Higher pitch /> <Video src={staticFile("video.mp4")} toneFrequency={0.8} // Lower pitch /> ``` Pitch shifting only works during server-side rendering, not in the Remotion Studio preview or in the `<Player />`. -
ffmpeg.md 1.1 KB
--- name: ffmpeg description: Using FFmpeg and FFprobe in Remotion metadata: tags: ffmpeg, ffprobe, video, trimming --- ## FFmpeg in Remotion `ffmpeg` and `ffprobe` do not need to be installed. They are available via the `npx remotion ffmpeg` and `npx remotion ffprobe`: ```bash npx remotion ffmpeg -i input.mp4 output.mp3 npx remotion ffprobe input.mp4 ``` ### Trimming videos You have 2 options for trimming videos: 1. **Preferred**: Use the `trimBefore` and `trimAfter` props of the `<Video>` component. This is non-destructive, requires no re-encoding, and you can change the trim at any time. ```tsx import {Video} from '@remotion/media'; <Video src={staticFile('video.mp4')} trimBefore={5 * fps} trimAfter={10 * fps} />; ``` 2. Use the FFmpeg command line. You MUST re-encode the video to avoid frozen frames at the start of the video. Only use this if you need a standalone trimmed file (e.g. for upload or external use). ```bash # Re-encodes from the exact frame npx remotion ffmpeg -ss 00:00:05 -i public/input.mp4 -to 00:00:10 -c:v libx264 -c:a aac public/output.mp4 ``` -
gifs.md 3.7 KB
--- name: gif description: Displaying GIFs, APNG, AVIF and WebP in Remotion metadata: tags: gif, animation, images, animated, apng, avif, webp --- # Using Animated images in Remotion ## Basic usage Use `<AnimatedImage>` to display a GIF, APNG, AVIF or WebP image synchronized with Remotion's timeline: ```tsx import { AnimatedImage, staticFile } from "remotion"; export const MyComposition = () => { return ( <AnimatedImage src={staticFile("animation.gif")} width={500} height={500} /> ); }; ``` Remote URLs are also supported (must have CORS enabled): ```tsx <AnimatedImage src="https://example.com/animation.gif" width={500} height={500} /> ``` ## Sizing and fit Control how the image fills its container with the `fit` prop: ```tsx // Stretch to fill (default) <AnimatedImage src={staticFile("animation.gif")} width={500} height={300} fit="fill" /> // Maintain aspect ratio, fit inside container <AnimatedImage src={staticFile("animation.gif")} width={500} height={300} fit="contain" /> // Fill container, crop if needed <AnimatedImage src={staticFile("animation.gif")} width={500} height={300} fit="cover" /> ``` ## Playback speed Use `playbackRate` to control the animation speed: ```tsx // 2x speed <AnimatedImage src={staticFile("animation.gif")} width={500} height={500} playbackRate={2} /> // Half speed <AnimatedImage src={staticFile("animation.gif")} width={500} height={500} playbackRate={0.5} /> ``` ## Looping behavior Control what happens when the animation finishes: ```tsx // Loop indefinitely (default) <AnimatedImage src={staticFile("animation.gif")} width={500} height={500} loopBehavior="loop" /> // Play once, show final frame <AnimatedImage src={staticFile("animation.gif")} width={500} height={500} loopBehavior="pause-after-finish" /> // Play once, then clear canvas <AnimatedImage src={staticFile("animation.gif")} width={500} height={500} loopBehavior="clear-after-finish" /> ``` ## Styling Use the `style` prop for additional CSS (use `width` and `height` props for sizing): ```tsx <AnimatedImage src={staticFile("animation.gif")} width={500} height={500} style={{ borderRadius: 20, position: "absolute", top: 100, left: 50, }} /> ``` ## Getting GIF duration Use `getGifDurationInSeconds()` from `@remotion/gif` to get the duration of a GIF. ```bash npx remotion add @remotion/gif ``` ```tsx import { getGifDurationInSeconds } from "@remotion/gif"; import { staticFile } from "remotion"; const duration = await getGifDurationInSeconds(staticFile("animation.gif")); console.log(duration); // e.g. 2.5 ``` This is useful for setting the composition duration to match the GIF: ```tsx import { getGifDurationInSeconds } from "@remotion/gif"; import { staticFile, CalculateMetadataFunction } from "remotion"; const calculateMetadata: CalculateMetadataFunction = async () => { const duration = await getGifDurationInSeconds(staticFile("animation.gif")); return { durationInFrames: Math.ceil(duration * 30), }; }; ``` ## Alternative If `<AnimatedImage>` does not work (only supported in Chrome and Firefox), you can use `<Gif>` from `@remotion/gif` instead. ```bash npx remotion add @remotion/gif # If project uses npm bunx remotion add @remotion/gif # If project uses bun yarn remotion add @remotion/gif # If project uses yarn pnpm exec remotion add @remotion/gif # If project uses pnpm ``` ```tsx import { Gif } from "@remotion/gif"; import { staticFile } from "remotion"; export const MyComposition = () => { return <Gif src={staticFile("animation.gif")} width={500} height={500} />; }; ``` The `<Gif>` component has the same props as `<AnimatedImage>` but only supports GIF files. -
google-fonts.md 1.7 KB
--- name: fonts description: Loading Google Fonts and local fonts in Remotion metadata: tags: fonts, google-fonts, typography, text --- # Using fonts in Remotion ## Google Fonts with @remotion/google-fonts The recommended way to use Google Fonts. It's type-safe and automatically blocks rendering until the font is ready. ### Prerequisites First, the @remotion/google-fonts package needs to be installed. If it is not installed, use the following command: ```bash npx remotion add @remotion/google-fonts # If project uses npm bunx remotion add @remotion/google-fonts # If project uses bun yarn remotion add @remotion/google-fonts # If project uses yarn pnpm exec remotion add @remotion/google-fonts # If project uses pnpm ``` ```tsx import { loadFont } from "@remotion/google-fonts/Lobster"; const { fontFamily } = loadFont(); export const MyComposition = () => { return ( <div style={{ fontFamily }}> Hello World </div> ); }; ``` Preferrably, specify only needed weights and subsets to reduce file size: ```tsx import { loadFont } from "@remotion/google-fonts/Roboto"; const { fontFamily } = loadFont("normal", { weights: ["400", "700"], subsets: ["latin"], }); ``` ## Using in components Call `loadFont()` at the top level of your component or in a separate file that's imported early: ```tsx import { loadFont } from "@remotion/google-fonts/Montserrat"; const { fontFamily } = loadFont("normal", { weights: ["400", "700"], subsets: ["latin"], }); export const Title: React.FC<{ text: string }> = ({ text }) => { return ( <h1 style={{ fontFamily, fontSize: 80, fontWeight: "bold", }} > {text} </h1> ); }; ``` -
html-in-canvas.md 3.5 KB
# Using `<HtmlInCanvas>` in Remotion Renders children into a `<canvas>` so you can post-process them with the Canvas 2D API or WebGL. Only works in Chrome 149+ with the `chrome://flags/#canvas-draw-element` flag enabled. Give the user a notice. ## Nesting Do not nest `<HtmlInCanvas>` components. Remotion rejects nesting because Chrome does not reliably render nested HTML-in-canvas subtrees. ## Enabling WebGL during renders If you make use of WebGL during renders, you need to enable it: From the CLI: ```bash npx remotion render --gl=angle ``` Set it as the default for Studio and CLI (advised): ```ts import { Config } from "@remotion/cli/config"; Config.setChromiumOpenGlRenderer("angle"); ``` ## Basic usage By default, draws to canvas with no effect applied: ```tsx import { HtmlInCanvas } from "remotion"; export const MyComp = () => { return ( <HtmlInCanvas width={1280} height={720}> <div style={{ fontSize: 80 }}> Hello </div> </HtmlInCanvas> ); }; ``` ## 2D effect with `onPaint` `onPaint` runs whenever the content updates. Call `ctx.drawElementImage(elementImage, 0, 0)` to draw the captured DOM, and assign the returned transform to `element.style.transform` so DOM selection still aligns with the painted output. ```tsx import { AbsoluteFill, HtmlInCanvas, type HtmlInCanvasOnPaint, useCurrentFrame, useVideoConfig, } from "remotion"; import { useCallback } from "react"; export const Blur = () => { const frame = useCurrentFrame(); const { width, height, fps } = useVideoConfig(); const onPaint: HtmlInCanvasOnPaint = useCallback( ({ canvas, element, elementImage }) => { const ctx = canvas.getContext("2d"); if (!ctx) throw new Error("Failed to acquire 2D context"); const blurPx = 4 + 18 * (0.5 + 0.5 * Math.sin((frame / fps) * Math.PI)); ctx.reset(); ctx.filter = `blur(${blurPx}px)`; const transform = ctx.drawElementImage(elementImage, 0, 0); element.style.transform = transform.toString(); }, [frame, fps], ); return ( <HtmlInCanvas width={width} height={height} onPaint={onPaint}> <AbsoluteFill style={{ justifyContent: "center", alignItems: "center", fontSize: 120, }} > <h1> Hello </h1> </AbsoluteFill> </HtmlInCanvas> ); }; ``` ## WebGL effects For WebGL, set up the context, program, and texture in `onInit` and return a cleanup function. Inside `onPaint`, upload the captured DOM with `gl.texElementImage2D(...)` and draw. ```tsx const onInit: HtmlInCanvasOnInit = useCallback(({ canvas }) => { const gl = canvas.getContext("webgl2", { alpha: true, premultipliedAlpha: true }); if (!gl) { throw new Error( "WebGL2 unavailable. Try rendering with the --gl=angle option. See https://remotion.dev/docs/gl-options.", ); } gl.pixelStorei(gl.UNPACK_FLIP_Y_WEBGL, true); // compile program, create texture, set up VAO... return () => { // delete program, texture, buffers... }; }, []); const onPaint: HtmlInCanvasOnPaint = useCallback(({ elementImage }) => { gl.texElementImage2D(gl.TEXTURE_2D, 0, gl.RGBA, gl.RGBA, gl.UNSIGNED_BYTE, elementImage); gl.drawArrays(gl.TRIANGLES, 0, 6); }, []); ``` For a fully working minimal example, see https://github.com/remotion-dev/remotion/blob/main/packages/docs/components/demos/HtmlInCanvasDocsDemoWebGL.tsx. ## Async `onPaint` `onPaint` may be `async`. Remotion holds the frame open via `delayRender()` until the promise resolves. Useful for multi-pass effects with `createImageBitmap`. -
images.md 1.4 KB
## Sizing and positioning Use the `style` prop to control size and position: ```tsx <Img src={staticFile("photo.png")} style={{ width: 500, height: 300, position: "absolute", top: 100, left: 50, objectFit: "cover", }} /> ``` ## Dynamic image paths Use template literals for dynamic file references: ```tsx import { Img, staticFile, useCurrentFrame } from "remotion"; const frame = useCurrentFrame(); // Image sequence <Img src={staticFile(`frames/frame${frame}.png`)} /> // Selecting based on props <Img src={staticFile(`avatars/${props.userId}.png`)} /> // Conditional images <Img src={staticFile(`icons/${isActive ? "active" : "inactive"}.svg`)} /> ``` This pattern is useful for: - Image sequences (frame-by-frame animations) - User-specific avatars or profile images - Theme-based icons - State-dependent graphics ## Getting image dimensions Use `getImageDimensions()` to get the dimensions of an image: ```tsx import { getImageDimensions, staticFile } from "remotion"; const { width, height } = await getImageDimensions(staticFile("photo.png")); ``` This is useful for calculating aspect ratios or sizing compositions: ```tsx import { getImageDimensions, staticFile, CalculateMetadataFunction, } from "remotion"; const calculateMetadata: CalculateMetadataFunction = async () => { const { width, height } = await getImageDimensions(staticFile("photo.png")); return { width, height, }; }; ``` -
light-leaks.md 3.1 KB
--- name: light-leaks description: Light leak overlay effects for Remotion using lightLeak() from @remotion/effects. metadata: tags: light-leaks, overlays, effects, transitions --- ## Light Leaks This only works from Remotion 4.0.500 and up. Use `npx remotion versions` to check your Remotion version and `npx remotion upgrade` to upgrade your Remotion version. Apply `lightLeak()` from `@remotion/effects/light-leak` to a canvas-based component such as `<Solid>`. Animate `progress` from `0` to `1`; the light leak reveals during the first half and retracts during the second half. Typically use it inside a `<TransitionSeries.Overlay>` to play over the cut point between two scenes. See the **transitions** rule for `<TransitionSeries>` and overlay usage. ## Prerequisites ```bash npx remotion add @remotion/effects ``` ## Light leak overlay component Keep the `progress` calculation inline so it is editable in Remotion Studio: ```tsx import {lightLeak} from '@remotion/effects/light-leak'; import {interpolate, Solid, useCurrentFrame, useVideoConfig} from 'remotion'; const LightLeakOverlay: React.FC<{ seed?: number; hueShift?: number; }> = ({seed = 0, hueShift = 0}) => { const frame = useCurrentFrame(); const {durationInFrames, height, width} = useVideoConfig(); return ( <Solid width={width} height={height} effects={[ lightLeak({ seed, hueShift, progress: interpolate(frame, [0, durationInFrames - 1], [0, 1], { extrapolateLeft: 'clamp', extrapolateRight: 'clamp', }), }), ]} /> ); }; ``` ## Basic usage with TransitionSeries ```tsx import {TransitionSeries} from '@remotion/transitions'; <TransitionSeries> <TransitionSeries.Sequence durationInFrames={60}> <SceneA /> </TransitionSeries.Sequence> <TransitionSeries.Overlay durationInFrames={30}> <LightLeakOverlay /> </TransitionSeries.Overlay> <TransitionSeries.Sequence durationInFrames={60}> <SceneB /> </TransitionSeries.Sequence> </TransitionSeries>; ``` ## Options - `progress?` — controls the evolve/retract phase from `0` to `1`. Effects do not animate on their own, so drive it with `useCurrentFrame()` and `interpolate()`. Default: `0.5`. - `seed?` — determines the shape of the light leak pattern. Different seeds produce different patterns. Default: `0`. - `hueShift?` — rotates the hue in degrees (`0`–`360`). Default: `0` (yellow-to-orange). `120` = green, `240` = blue. - `disabled?` — skips the effect when `true`. Default: `false`. ## Customizing the look ```tsx // Blue-tinted light leak with a different pattern <LightLeakOverlay seed={5} hueShift={240} />; // Green-tinted light leak <LightLeakOverlay seed={2} hueShift={120} />; ``` ## Standalone usage The overlay component can also be used outside of `<TransitionSeries>` as a decorative layer in any composition: ```tsx import {AbsoluteFill} from 'remotion'; const MyComp: React.FC = () => ( <AbsoluteFill> <MyContent /> <LightLeakOverlay seed={3} /> </AbsoluteFill> ); ``` `lightLeak()` uses WebGL2. Enable WebGL during rendering with `Config.setChromiumOpenGlRenderer("angle")`. -
local-fonts.md 1.5 KB
For local font files, use the `@remotion/fonts` package. ### Prerequisites First, install @remotion/fonts: ```bash npx remotion add @remotion/fonts # If project uses npm bunx remotion add @remotion/fonts # If project uses bun yarn remotion add @remotion/fonts # If project uses yarn pnpm exec remotion add @remotion/fonts # If project uses pnpm ``` ### Loading a local font Place your font file in the `public/` folder and use `loadFont()`: ```tsx import { loadFont } from "@remotion/fonts"; import { staticFile } from "remotion"; await loadFont({ family: "MyFont", url: staticFile("MyFont-Regular.woff2"), }); export const MyComposition = () => { return ( <div style={{ fontFamily: "MyFont" }}> Hello World </div> ); }; ``` ### Loading multiple weights Load each weight separately with the same family name: ```tsx import { loadFont } from "@remotion/fonts"; import { staticFile } from "remotion"; await Promise.all([ loadFont({ family: "Inter", url: staticFile("Inter-Regular.woff2"), weight: "400", }), loadFont({ family: "Inter", url: staticFile("Inter-Bold.woff2"), weight: "700", }), ]); ``` ### Available options ```tsx loadFont({ family: "MyFont", // Required: name to use in CSS url: staticFile("font.woff2"), // Required: font file URL format: "woff2", // Optional: auto-detected from extension weight: "400", // Optional: font weight style: "normal", // Optional: normal or italic display: "block", // Optional: font-display behavior }); ``` -
lottie.md 1.8 KB
--- name: lottie description: Embedding Lottie animations in Remotion. metadata: category: Animation --- # Using Lottie Animations in Remotion ## Prerequisites First, the @remotion/lottie package needs to be installed. If it is not, use the following command: ```bash npx remotion add @remotion/lottie # If project uses npm bunx remotion add @remotion/lottie # If project uses bun yarn remotion add @remotion/lottie # If project uses yarn pnpm exec remotion add @remotion/lottie # If project uses pnpm ``` ## Displaying a Lottie file To import a Lottie animation: - Fetch the Lottie asset - Wrap the loading process in `delayRender()` and `continueRender()` - Save the animation data in a state - Render the Lottie animation using the `Lottie` component from the `@remotion/lottie` package ```tsx import { Lottie, LottieAnimationData } from "@remotion/lottie"; import { useEffect, useState } from "react"; import { cancelRender, continueRender, delayRender } from "remotion"; export const MyAnimation = () => { const [handle] = useState(() => delayRender("Loading Lottie animation")); const [animationData, setAnimationData] = useState<LottieAnimationData | null>(null); useEffect(() => { fetch("https://assets4.lottiefiles.com/packages/lf20_zyquagfl.json") .then((data) => data.json()) .then((json) => { setAnimationData(json); continueRender(handle); }) .catch((err) => { cancelRender(err); }); }, [handle]); if (!animationData) { return null; } return <Lottie animationData={animationData} />; }; ``` ## Styling and animating Lottie supports the `style` prop to allow styles and animations: ```tsx return ( <Lottie animationData={animationData} style={{ width: 400, height: 400 }} /> ); ``` -
measuring-dom-nodes.md 995 B
--- name: measuring-dom-nodes description: Measuring DOM element dimensions in Remotion metadata: tags: measure, layout, dimensions, getBoundingClientRect, scale --- # Measuring DOM nodes in Remotion Remotion applies a `scale()` transform to the video container, which affects values from `getBoundingClientRect()`. Use `useCurrentScale()` to get correct measurements. ## Measuring element dimensions ```tsx import { useCurrentScale } from "remotion"; import { useRef, useEffect, useState } from "react"; export const MyComponent = () => { const ref = useRef<HTMLDivElement>(null); const scale = useCurrentScale(); const [dimensions, setDimensions] = useState({ width: 0, height: 0 }); useEffect(() => { if (!ref.current) return; const rect = ref.current.getBoundingClientRect(); setDimensions({ width: rect.width / scale, height: rect.height / scale, }); }, [scale]); return ( <div ref={ref}> Content to measure </div> ); }; ``` -
measuring-text.md 2.7 KB
--- name: measuring-text description: Measuring text dimensions, fitting text to containers, and checking overflow metadata: tags: measure, text, layout, dimensions, fitText, fillTextBox --- # Measuring text in Remotion ## Prerequisites Install @remotion/layout-utils if it is not already installed: ```bash npx remotion add @remotion/layout-utils ``` ## Measuring text dimensions Use `measureText()` to calculate the width and height of text: ```tsx import { measureText } from "@remotion/layout-utils"; const { width, height } = measureText({ text: "Hello World", fontFamily: "Arial", fontSize: 32, fontWeight: "bold", }); ``` Results are cached - duplicate calls return the cached result. ## Fitting text to a width Use `fitText()` to find the optimal font size for a container: ```tsx import { fitText } from "@remotion/layout-utils"; const { fontSize } = fitText({ text: "Hello World", withinWidth: 600, fontFamily: "Inter", fontWeight: "bold", }); return ( <div style={{ fontSize: Math.min(fontSize, 80), // Cap at 80px fontFamily: "Inter", fontWeight: "bold", }} > Hello World </div> ); ``` ## Checking text overflow Use `fillTextBox()` to check if text exceeds a box: ```tsx import { fillTextBox } from "@remotion/layout-utils"; const box = fillTextBox({ maxBoxWidth: 400, maxLines: 3 }); const words = ["Hello", "World", "This", "is", "a", "test"]; for (const word of words) { const { exceedsBox } = box.add({ text: word + " ", fontFamily: "Arial", fontSize: 24, }); if (exceedsBox) { // Text would overflow, handle accordingly break; } } ``` ## Best practices **Load fonts first:** Only call measurement functions after fonts are loaded. ```tsx import { loadFont } from "@remotion/google-fonts/Inter"; const { fontFamily, waitUntilDone } = loadFont("normal", { weights: ["400"], subsets: ["latin"], }); waitUntilDone().then(() => { // Now safe to measure const { width } = measureText({ text: "Hello", fontFamily, fontSize: 32, }); }); ``` **Use validateFontIsLoaded:** Catch font loading issues early: ```tsx measureText({ text: "Hello", fontFamily: "MyCustomFont", fontSize: 32, validateFontIsLoaded: true, // Throws if font not loaded }); ``` **Match font properties:** Use the same properties for measurement and rendering: ```tsx const fontStyle = { fontFamily: "Inter", fontSize: 32, fontWeight: "bold" as const, letterSpacing: "0.5px", }; const { width } = measureText({ text: "Hello", ...fontStyle, }); return ( <div style={fontStyle}> Hello </div> ); ``` **Avoid padding and border:** Use `outline` instead of `border` to prevent layout differences: ```tsx <div style={{ outline: "2px solid red" }}> Text </div> ``` -
multi-scene-video.md 2 KB
If the video being created is a multi-scene video, it should be structured in a special way. Create a new folder and put each scene in a separate file. ```tsx // SceneA.tsx export const SceneA: React.FC = () => { return // ... } ``` ```tsx // SceneB.tsx export const SceneB: React.FC = () => { return // ... } ``` Install `@remotion/transitions` if not yet available: ``` npx remotion add @remotion/transitions ``` // MyVideo.tsx ```tsx import {TransitionSeries} from '@remotion/transitions'; const MyVideo: React.FC = () => { return ( <TransitionSeries> <TransitionSeries.Sequence durationInFrames={4 * fps} name="SceneA"> <SceneA /> </TransitionSeries.Sequence> <TransitionSeries.Sequence durationInFrames={4 * fps} name="SceneB"> <SceneB /> </TransitionSeries.Sequence> </TransitionSeries> ) } ``` It could also make sense to register each scene individually in the root file so it can be edited there. If a composition with the same component is registered, one can double click the sequence in the main composition and jump to that composition. ```tsx export const Root: React.FC = () => { return ( <> <Folder id="MyVideo-Scenes"> <Composition id="Scene1" component={Scene1} durationInFrames={5 * fps} fps={30} width={1920} height={1080} /> <Composition id="Scene2" component={Scene2} durationInFrames={5 * fps} fps={30} width={1920} height={1080} /> </Folder> <Composition id="MyVideo" component={MyVideo} durationInFrames={10 * fps} fps={30} width={1920} height={1080} /> </> ) } ``` This allows the user to trim the start and end of the durations visually and add [transitions](./transitions.md) later. Prefer inlining the `durationInFrames` values, because only then they are editable. It's okay if the value is redundant. -
parameters.md 2.3 KB
--- name: parameters description: Make a video parametrizable by adding a Zod schema metadata: tags: parameters, zod, schema --- To make a video parametrizable, a Zod schema can be added to a composition. First, `zod` must be installed . Search the project for lockfiles and run the correct command depending on the package manager: If `package-lock.json` is found, use the following command: ```bash npm i zod ``` If `bun.lockb` is found, use the following command: ```bash bun i zod ``` If `yarn.lock` is found, use the following command: ```bash yarn add zod ``` If `pnpm-lock.yaml` is found, use the following command: ```bash pnpm i zod ``` Then, a Zod schema can be defined alongside the component: ```tsx title="src/MyComposition.tsx" import { z } from "zod"; export const MyCompositionSchema = z.object({ title: z.string(), }); const MyComponent: React.FC<z.infer<typeof MyCompositionSchema>> = () => { return ( <div> <h1> {props.title} </h1> </div> ); }; ``` In the root file, the schema can be passed to the composition: ```tsx title="src/Root.tsx" import { Composition } from "remotion"; import { MycComponent, MyCompositionSchema } from "./MyComposition"; export const RemotionRoot = () => { return ( <Composition id="MyComposition" component={MyComponent} durationInFrames={100} fps={30} width={1080} height={1080} defaultProps={{ title: "Hello World" }} schema={MyCompositionSchema} /> ); }; ``` Now, the user can edit the parameter visually in the sidebar. All schemas that are supported by Zod are supported by Remotion. Remotion requires that the top-level type is a z.object(), because the collection of props of a React component is always an object. ## Color picker For adding a color picker, use `zColor()` from `@remotion/zod-types`. If it is not installed, use the following command: ```bash npx remotion add @remotion/zod-types # If project uses npm bunx remotion add @remotion/zod-types # If project uses bun yarn remotion add @remotion/zod-types # If project uses yarn pnpm exec remotion add @remotion/zod-types # If project uses pnpm ``` Then import `zColor` from `@remotion/zod-types`: ```tsx import { zColor } from "@remotion/zod-types"; ``` Then use it in the schema: ```tsx export const MyCompositionSchema = z.object({ color: zColor(), }); ``` -
sequencing.md 3.7 KB
--- name: sequencing description: Sequencing patterns for Remotion - delay, trim, limit duration of items metadata: tags: sequence, series, timing, delay, trim --- Use `<Sequence>` to delay when an element appears in the timeline. ```tsx const Main = () => { return ( <AbsoluteFill> <Background /> <AbsoluteFill> <Sequence name="Title" from={30} durationInFrames={60} layout="none"> <Title /> </Sequence> <Sequence name="Subtitle" from={60} durationInFrames={60} layout="none" > <Subtitle /> </Sequence> </AbsoluteFill> </AbsoluteFill> ); } export const Title = () => { const frame = useCurrentFrame(); return ( <Interactive.Div name="Label" style={{ opacity: interpolate(frame, [0, 60], [0, 1], { extrapolateRight: "clamp", extrapolateLeft: "clamp", easing: Easing.bezier(0.16, 1, 0.3, 1), }), fontSize: 88 }} > Title </Interactive.Div> ); }; export const Subtitle = () => { const frame = useCurrentFrame(); return ( <Interactive.Div name="Subtitle" style={{ opacity: interpolate(frame, [0, 60], [0, 1], { extrapolateRight: "clamp", extrapolateLeft: "clamp", easing: Easing.bezier(0.16, 1, 0.3, 1), }), fontSize: 32 }} > Subtitle </Interactive.Div> ); }; ``` This will by default wrap the component in an absolute fill element. If the items should not be wrapped, use the `layout` prop: ```tsx <Sequence layout="none"> <Title /> </Sequence> ``` ## Premounting This loads the component in the timeline before it is actually played. Always premount any `<Sequence>`! ```tsx <Sequence premountFor={1 * fps}> <Title /> </Sequence> ``` ## Series Use `<Series>` when elements should play one after another without overlap. ```tsx import { Series } from "remotion"; <Series> <Series.Sequence durationInFrames={45}> <Intro /> </Series.Sequence> <Series.Sequence durationInFrames={60}> <MainContent /> </Series.Sequence> <Series.Sequence durationInFrames={30}> <Outro /> </Series.Sequence> </Series>; ``` Same as with `<Sequence>`, the items will be wrapped in an absolute fill element by default when using `<Series.Sequence>`, unless the `layout` prop is set to `none`. ### Series with overlaps Use negative offset for overlapping sequences: ```tsx <Series> <Series.Sequence durationInFrames={60}> <SceneA /> </Series.Sequence> <Series.Sequence offset={-15} durationInFrames={60}> {/* Starts 15 frames before SceneA ends */} <SceneB /> </Series.Sequence> </Series> ``` ## Frame References Inside Sequences Inside a Sequence, `useCurrentFrame()` returns the local frame (starting from 0): ```tsx <Sequence from={60} durationInFrames={30}> <MyComponent /> {/* Inside MyComponent, useCurrentFrame() returns 0-29, not 60-89 */} </Sequence> ``` ## Nested Sequences Sequences can be nested for complex timing: ```tsx <Sequence from={0} durationInFrames={120}> <Background /> <Sequence from={15} durationInFrames={90} layout="none"> <Title /> </Sequence> <Sequence from={45} durationInFrames={60} layout="none"> <Subtitle /> </Sequence> </Sequence> ``` ## Nesting compositions within another To add a composition within another composition, you can use the `<Sequence>` component with a `width`, `height`, `durationInFrames` prop to specify the size of the composition. This will override the values of `useVideoConfig()` when calling inside that component. ```tsx <AbsoluteFill> <Sequence width={500} height={500} durationInFrames={100} from={30}> <CompositionComponent /> </Sequence> </AbsoluteFill> ``` -
sfx.md 1.8 KB
--- name: sfx description: Including sound effects metadata: tags: sfx, sound, effect, audio --- To include a sound effect, use the `<Audio>` tag: ```tsx import { Audio } from "@remotion/sfx"; <Audio src={"https://remotion.media/whoosh.wav"} />; ``` The following sound effects are available: - `https://remotion.media/whoosh.wav` - `https://remotion.media/whip.wav` - `https://remotion.media/page-turn.wav` - `https://remotion.media/switch.wav` - `https://remotion.media/mouse-click.wav` - `https://remotion.media/shutter-modern.wav` - `https://remotion.media/shutter-old.wav` - `https://remotion.media/ding.wav` - `https://remotion.media/bruh.wav` - `https://remotion.media/vine-boom.wav` - `https://remotion.media/windows-xp-error.wav` - `https://remotion.media/fah.wav` - `https://remotion.media/spongebob-fail.wav` - `https://remotion.media/omg-hell-nah.wav` - `https://remotion.media/price-is-right-fail.wav` - `https://remotion.media/romance-meme.wav` - `https://remotion.media/bone-crack.wav` - `https://remotion.media/anime-wow.wav` - `https://remotion.media/yippee.wav` - `https://remotion.media/loading-lag.wav` - `https://remotion.media/wilhelm-scream.wav` - `https://remotion.media/mac-quack.wav` - `https://remotion.media/skedaddle.wav` - `https://remotion.media/snapchat-notification.wav` - `https://remotion.media/nelly-ahh.wav` - `https://remotion.media/sanctuary-guardian-what.wav` - `https://remotion.media/minecraft-hurt.wav` - `https://remotion.media/oh-my-god-vine.wav` - `https://remotion.media/illuminati-confirmed.wav` - `https://remotion.media/dramatic-boomer.wav` - `https://remotion.media/triggered.wav` - `https://remotion.media/record-scratch.wav` For more sound effects, search the internet. A good resource is https://github.com/kapishdima/soundcn/tree/main/assets. -
silence-detection.md 2.5 KB
--- name: silence-detection description: Adaptive silence detection for video/audio files using FFmpeg loudnorm and silencedetect metadata: tags: silence, detection, trimming, ffmpeg, loudnorm, audio --- # Adaptive Silence Detection Detect silent segments in video or audio files. Requires FFmpeg — see [ffmpeg.md](./ffmpeg.md) for how to invoke it in Remotion projects. ## Step 1: Measure loudness with `loudnorm` Use the `loudnorm` filter in JSON mode to get the EBU R128 integrated loudness and gating threshold for each file: ```bash npx remotion ffmpeg -i public/video.mov -map 0:a -af loudnorm=print_format=json -f null /dev/null ``` As output you will get: - `input_i`: Integrated loudness (dB) — the overall perceived volume - `input_thresh`: EBU R128 gating threshold (dB) — the level below which audio is considered too quiet to count toward loudness measurement ## Step 2: Detect silences using adaptive threshold Pass the `input_thresh` value from step 1 as the `noise` parameter to `silencedetect`: ```bash npx remotion ffmpeg -i public/video.mov -map 0:a -af "silencedetect=noise=${THRESH}dB:d=0.5" -f null /dev/null ``` Parameters: - `noise`: The threshold below which audio is considered silent. Use `input_thresh` from step 1. - `d`: Minimum silence duration in seconds. `0.5` is a good default. ## Interpreting the output The filter outputs pairs of `silence_start` and `silence_end` timestamps: ``` [silencedetect] silence_start: 0 [silencedetect] silence_end: 2.241021 | silence_duration: 2.241021 [silencedetect] silence_start: 38.77425 [silencedetect] silence_end: 39.619604 | silence_duration: 0.845354 ``` ## Identifying leading and trailing silence - **Leading silence**: Consecutive silence segments starting at or near 0. If the first `silence_start` is > 0.5s, there is no leading silence. - **Trailing silence**: The last silence segment that extends to (or near) the end of the file. Compare the last `silence_end` with the file's total duration. When multiple silences are nearly contiguous at the start or end (gap < 0.2s), treat them as a single leading/trailing silence block. ## Using with Remotion's `<Video>` component Apply the detected trim points using `trimBefore` and `trimAfter` (values are in frames): ```tsx import { Video } from "@remotion/media"; import { staticFile, useVideoConfig } from "remotion"; const { fps } = useVideoConfig(); <Video src={staticFile("video.mov")} trimBefore={Math.floor(leadingEnd * fps)} trimAfter={Math.ceil(trailingStart * fps)} /> ``` -
SKILL.md 10.7 KB
--- name: remotion-markup description: Content, animation and effects best practices metadata: version: "4.0.520" --- This is guidance for writing Remotion React Markup. If this is not relevant, load Remotion Best Practices instead. ## Preserve user changes Users may make edits in the code outside of the conversation. If you detect a surprising change made in the meanwhile, don't overwrite it, assume it was intentional or ask for confirmation. ## General rules Drive animations using `useCurrentFrame()` and `interpolate()`. CSS `transition` or `animation` will not render correctly, they need to refactored. Tailwind animation class will not render correctly, they need to be refactored. Use `Easing.bezier()` and `Easing.spring()` to customize timing. Structure your markup according to Remotion Interactivity Best Practices ```tsx import { useCurrentFrame, Easing, interpolate, Interactive } from "remotion"; export const FadeIn = () => { const frame = useCurrentFrame(); return ( <Interactive.Div name="Title" style={{ opacity: interpolate(frame, [0, 2 * fps], [0, 1], { extrapolateRight: "clamp", extrapolateLeft: "clamp", easing: Easing.bezier(0.16, 1, 0.3, 1), }), }} > Hello World! </Interactive.Div> ); }; ``` Keep the `interpolate()` call inline in the `style` prop. Use `scale`, `translate`, `rotate` CSS properties over `transform`. ```tsx // 👍 Inline editable keyframes and transform shorthands style={{ scale: interpolate(frame, [0, 100], [0, 1], { extrapolateLeft: 'clamp', extrapolateRight: 'clamp', easing: Easing.spring({damping: 200}), output: 'perceptual-scale' // For `scale` animations, use "output: 'perceptual-scale'" }), translate: interpolate(frame, [0, 100], ["0px 0px", "100px 100px"], { extrapolateLeft: 'clamp', extrapolateRight: 'clamp', easing: Easing.spring({damping: 200}), }), rotate: interpolate(frame, [0, 100], ["20deg", "90deg"], { extrapolateLeft: 'clamp', extrapolateRight: 'clamp', easing: Easing.spring({damping: 200}), }), }} // 👎 Non-inline values and transform strings become harder to edit in Studio const scale = interpolate(frame, [0, 100], [0, 1]); style={{ transform: `scale(${scale})`, }} ``` ## Assets Place assets in the `public/` folder at your project root. Use `staticFile()` to reference files from the `public/` folder. ## Media components Add video and audio using `<Video>` and `<Audio>` from `@remotion/media`. Add images using the `<CanvasImage>` component. Add animated GIFs, APNG, WebP or AVIF images using `<AnimatedImage>`, use `@remotion/gif` if not using Chrome. Use `staticFile()` for files in `public/` or pass a remote URL directly: ```tsx import { Audio, Video } from "@remotion/media"; import { staticFile, CanvasImage, AnimatedImage } from "remotion"; export const MyComposition = () => { return ( <> <Video src={staticFile("video.mp4")} style={{ opacity: 0.5 }} /> <Audio src={staticFile("audio.mp3")} /> <CanvasImage src={staticFile("logo.png")} style={{ width: 100, height: 100 }} /> <Video src="https://remotion.media/video.mp4" /> <AnimatedImage src={staticFile('nyancat.gif')} /> </> ); }; ``` ## Example scene ```tsx import { AbsoluteFill, Easing, Interactive, interpolate, useCurrentFrame, useVideoConfig } from "remotion"; export const Empty = () => { const {fps} = useVideoConfig(); const frame = useCurrentFrame(); return ( <AbsoluteFill name="Scene" style={{ display: 'flex', justifyContent: 'center', alignItems: 'center', backgroundColor: 'white' }} > <Interactive.Div name="Title" style={{ opacity: interpolate(frame, [1 * fps, 2 * fps], [0, 1], { extrapolateRight: "clamp", extrapolateLeft: "clamp", easing: Easing.bezier(0.16, 1, 0.3, 1), }), fontSize: 88 }} > Title </Interactive.Div> <Interactive.Div name="Subtitle" style={{ opacity: interpolate(frame, [2 * fps, 3 * fps, 8 * fps, 10 * fps], [0, 1, 1, 0], { extrapolateRight: "clamp", extrapolateLeft: "clamp", easing: [Easing.bezier(0.16, 1, 0.3, 1), Easing.linear, Easing.bezier(0.16, 1, 0.3, 1)], }), fontSize: 32 }} > Subtitle </Interactive.Div> </AbsoluteFill> ); } ``` ## Delaying, trimming Most components (`<AbsoluteFill>`, `<Interactive.*>` `<Img>`, `<AnimatedImage>`, `<CanvasImage>`, `<HtmlInCanvas>`, `<Solid>`, `<Sequence>` from `remotion`, `<Video>` and `<Audio>` from `@remotion/media`, `<Gif>`, and more) support the following props: ### from ```tsx <Img from={1 * fps} {/* ... */}/> <Video from={1 * fps} {/* ... */}/> <Interactive.Div from={1 * fps} {/* ... */}/> ``` When the element starts appearing in the timelien. ### durationInFrames ```tsx <Img durationInFrames={20 * fps} {/* ... */}/> <Interactive.Div durationInFrames={20 * fps} {/* ... */}/> ``` For how long the layer plays in the timeline. For media, pass the natural duration of the media: `<Video durationInFrames={29.322 * fps}/>` ### `trimBefore` Useful for components whose internal clock should start later: ```tsx // Trim away first 2 seconds of footage <Video trimBefore={2 * fps} {/* ... */} /> // `useCurrenFrame()` for children starts at `10 * fps` <Sequence trimBefore={10 * fps} {/* ... */} /> ``` ### Fallback If a component does not support these props, wrap it in`<Sequence>` from `remotion`, which has them. - `layout="absolute-fill"` makes the Sequence behave like AbsoluteFill - `layout="none"` is "headless" mode, no wrapper element is used. ## Maps See [Remotion Maps](./remotion-maps/REFERENCE.md) if wanting to include maps in the video. ## Text highlights and annotations See [text-highlights.md](text-highlights.md) for text highlights (highlight markers), circles, underlines, strike-throughs, crossed-off text, boxes. ## Multi-scene videos See [multi-scene-video.md](multi-scene-video.md) if planning to make a video with multiple subsequent scenes. ## Voiceover See [voiceover.md](voiceover.md) for adding an AI-generated voiceover to Remotion compositions using ElevenLabs TTS. ## Embedding Videos See [embedding-videos.md](embedding-videos.md) for advanced knowledge about embedding videos - trimming, volume, speed, looping, pitch. ## Embedding Audio See [audio.md](audio.md) for advanced audio features like trimming, volume, speed, pitch. ## Video editing See [video-editing.md](video-editing.md) for structuring editable video timelines in Remotion Studio. ## Cropping See [cropping.md](cropping.md) if needing to crop the visible rectangle of a component. ## Transitions See [transitions.md](transitions.md) for scene transition patterns. ## Visual and pixel effects When creating a visual effect, consider whether it is feasible using CSS and HTML, or whether a shader is needed. Order or preference: 1. Regular HTML + CSS or other web techniques 2. An effect applied to the element directly (`<Video>`, `<Img>`), or by wrapping the content in [`<HtmlInCanvas>`](html-in-canvas.md), which also accepts `effects`: - A listed effect via [effects.md](effects.md) - A custom `createEffect()` via [effects.md](effects.md) when no preset is available. ## 3D content See [./3d.md](./3d.md) for 3D content in Remotion using Three.js and React Three Fiber. ## Sound effects When needing to use sound effects, load the [./sfx.md](./sfx.md) file for more information. ## Audio visualization When needing to visualize audio (spectrum bars, waveforms, bass-reactive effects), load the [./audio-visualization.md](./audio-visualization.md) file for more information. ## Maps For static maps, animated routes and markers, geographic explainers, Mapbox, MapLibre, MapTiler, GeoJSON, or 3D geographic flyovers, load [Remotion Maps](./remotion-maps/REFERENCE.md). ## Captions When dealing with captions or subtitles, load the Remotion Captions skill for more information. ## Google Fonts Is the recommended way to load fonts in Remotion. See [google-fonts.md](google-fonts.md) for how to load Google Fonts. ## Local fonts See [local-fonts.md](local-fonts.md) for how to load local fonts. ## GIFs See [gifs.md](gifs.md) for how to display GIFs synchronized with Remotion's timeline. ## Advanced Images See [images.md](images.md) for sizing and positioning images, dynamic image paths, and getting image dimensions. ## Lottie animations See [lottie.md](lottie.md) for embedding Lottie animations in Remotion. ## Timing See [timing.md](timing.md) for more timing techniques for `interpolate()`. ## Parameterized videos See [parameters.md](parameters.md) for making a composition parametrizable by adding a Zod schema. ## Measuring DOM nodes See [measuring-dom-nodes.md](measuring-dom-nodes.md) for measuring DOM element dimensions in Remotion. ## Measuring text See [measuring-text.md](measuring-text.md) for measuring text dimensions, fitting text to containers, and checking overflow. ## Using FFmpeg For some video operations, such as trimming videos or detecting silence, FFmpeg should be used. Load the [./ffmpeg.md](./ffmpeg.md) file for more information. ## Silence detection When needing to detect and trim silent segments from video or audio files, load the [./silence-detection.md](./silence-detection.md) file. ## Dynamic duration, dimensions and data See [calculate-metadata.md](calculate-metadata.md) for dynamically set composition duration, dimensions, and props. ## Advanced compositions See [compositions.md](compositions.md) for how to define stills, folders, default props and for how to nest compositions. ## Advanced sequencing See [sequencing.md](sequencing.md) for more sequencing patterns - delay, trim, limit duration of items. ## Install modules Use `npx remotion add` to add new packages with the right version: ``` npx remotion add @remotion/media ``` This goes for `@remotion/*` packages, `mediabunny`, `@mediabunny/*`, and `zod`. ## Previewing markup ``` npx remotion studio --no-open ``` This will start a long-running process and print the server URL for the preview. If server is already started, it will print the URL. You can visit a specific composition by navigating to `/[composition-id]`, for example `http://localhost:3000/MapAnimation`. ## Optional: one-frame render check You can render a single frame with the CLI to sanity-check layout, colors, or timing. Skip it for trivial edits, pure refactors, or when you already have enough confidence from Studio or prior renders. ```bash npx remotion still [composition-id] --scale=0.25 --frame=30 ``` At 30 fps, `--frame=30` is the one-second mark (`--frame` is zero-based). -
text-highlights.md 1.8 KB
--- name: text-highlights description: Animated text highlights and hand-drawn annotations using @remotion/rough-notation. metadata: tags: text, highlights, annotations, circles, rough-notation --- # Text highlights Use `@remotion/rough-notation` to draw animated annotations around or behind text. It supports highlights, circles, underlines, strike-throughs, crossed-off text, boxes, and brackets. Docs: https://www.remotion.dev/docs/text-highlights Install the package using the same Remotion version as the project: ```bash bunx remotion add @remotion/rough-notation ``` Choose the component that describes the annotation: `<Highlight>`, `<Circle>`, `<Underline>`, `<StrikeThrough>`, `<CrossedOff>`, `<Box>`, or `<Bracket>`. The component determines both the annotation style and whether it renders behind or on top of the text. Drive `progress` from `useCurrentFrame()` so the annotation is deterministic and synchronized with the video: ```tsx import {Circle, Highlight} from '@remotion/rough-notation'; import {interpolate, useCurrentFrame} from 'remotion'; export const TextAnnotations: React.FC = () => { const frame = useCurrentFrame(); return ( <div style={{fontSize: 80}}> This is{' '} <Highlight color="rgba(255, 236, 79, 0.62)" progress={interpolate(frame, [15, 40], [0, 1], { extrapolateLeft: 'clamp', extrapolateRight: 'clamp', })} > important </Highlight> , and this is{' '} <Circle color="#2563eb" progress={interpolate(frame, [15, 40], [0, 1], { extrapolateLeft: 'clamp', extrapolateRight: 'clamp', })}> connected </Circle> . </div> ); }; ``` Keep `progress` inline, hardcoded and use `interpolate` for maximum Studio interactivity. -
timing.md 3.2 KB
Drive motion with `interpolate()` over an explicit frame range. To customize timing, use **`Easing.bezier`** or `Easing.spring`. A simple linear interpolation is done using the `interpolate` function. ```ts title="Going from 0 to 1 over 0.3 seconds" import { interpolate } from "remotion"; const opacity = interpolate(frame, [0, 0.3 * fps], [0, 1]); ``` By default, the values are not clamped, so the value can go outside the range [0, 1]. Here is how they can be clamped: ```ts title="Going from 0 to 1 over 0.3 seconds with extrapolation" const opacity = interpolate(frame, [0, 0.3 * fps], [0, 1], { extrapolateRight: "clamp", extrapolateLeft: "clamp", }); ``` ## Studio-editable animation patterns When an animation should be editable in Remotion Studio, keep the `interpolate()` call directly in the `style` prop and prefer individual CSS transform properties: ```tsx // 👍 Inline editable keyframes and transform shorthands style={{ scale: interpolate(frame, [0, 100], [0, 1]), translate: interpolate(frame, [0, 100], ["0px 0px", "100px 100px"]), rotate: interpolate(frame, [0, 100], ["20deg", "90deg"]), }} // 👎 Hidden values and transform strings become computed in Studio const translateY = interpolate(frame, [0, 100], [0, 120]); const rotation = interpolate(frame, [0, 100], [0, 20]); style={{ transform: `translateY(${translateY}px) rotate(${rotation}deg)`, }} ``` Use `transform` strings only when individual CSS transform properties do not cover the effect, such as `skew()`, `perspective()`, or order-sensitive multi-transform chains. ## Spring easing A nice push movement with no bounce: ```ts import { interpolate, Easing } from "remotion"; const opacity = interpolate(frame, [0, 0.3 * fps], [0, 1], { easing: Easing.spring({damping: 200}), extrapolateLeft: "clamp", extrapolateRight: "clamp", }); ``` ## Bézier easing Pass values like you would to a CSS cubic-bezier function. ```ts import { interpolate, Easing } from "remotion"; const opacity = interpolate(frame, [0, 0.3 * fps], [0, 1], { easing: Easing.bezier(0.16, 1, 0.3, 1), extrapolateLeft: "clamp", extrapolateRight: "clamp", }); ``` ## Animating scale When animating scale, if the output is linear, the perceived scale would be smaller the larger the scale gets. Use this option to compensate: ```ts const scale = interpolate(frame, [0, 0.3 * fps], [0, 1], { easing: Easing.bezier(0.16, 1, 0.3, 1), extrapolateLeft: "clamp", extrapolateRight: "clamp", output: 'perceptual-scale' // <- Add this to scale animations }); ``` ## Multiple keyframes Add as many keyframes as you want. For multiple easings, pass an array with `n - 1` items: ```ts const scale = interpolate(frame, [0, 1 * fps, 9 * fps, 10 * fps], [0, 1, 1, 0], { easing: [Easing.bezier(0.16, 1, 0.3, 1), Easing.linear, Easing.spring({damping: 200})], extrapolateLeft: "clamp", extrapolateRight: "clamp", output: 'perceptual-scale' // <- Add this to scale animations }); ``` ## Posterization You can intentionally reduce the frame rate for artistic reason. Use if it makes sense. ```ts const scale = interpolate(frame, [0, 1 * fps], [0, 1], { easing: Easing.bezier(0.16, 1, 0.3, 1), extrapolateLeft: "clamp", extrapolateRight: "clamp", posterize: 3 // Only every 3rd frame is sampled }); ``` -
transitions.md 6.7 KB
--- name: transitions description: Scene transitions and overlays for Remotion using TransitionSeries. metadata: tags: transitions, overlays, fade, slide, wipe, scenes --- ## TransitionSeries `<TransitionSeries>` arranges scenes and supports two ways to enhance the cut point between them: - **Transitions** (`<TransitionSeries.Transition>`) — crossfade, slide, wipe, etc. between two scenes. Shortens the timeline because both scenes play simultaneously during the transition. - **Overlays** (`<TransitionSeries.Overlay>`) — render an effect (e.g. a light leak) on top of the cut point without shortening the timeline. Children are absolutely positioned. ## Prerequisites ```bash npx remotion add @remotion/transitions ``` ## Transition example ```tsx import { TransitionSeries, linearTiming } from "@remotion/transitions"; import { fade } from "@remotion/transitions/fade"; <TransitionSeries> <TransitionSeries.Sequence durationInFrames={60}> <SceneA /> </TransitionSeries.Sequence> <TransitionSeries.Transition presentation={fade()} timing={linearTiming({ durationInFrames: 15 })} /> <TransitionSeries.Sequence durationInFrames={60}> <SceneB /> </TransitionSeries.Sequence> </TransitionSeries>; ``` ## Overlay example Any React component can be used as an overlay. For a ready-made effect, see the **light-leaks** rule. ```tsx import {lightLeak} from '@remotion/effects/light-leak'; import {TransitionSeries} from '@remotion/transitions'; import {interpolate, Solid, useCurrentFrame, useVideoConfig} from 'remotion'; const LightLeakOverlay: React.FC = () => { const frame = useCurrentFrame(); const {durationInFrames, height, width} = useVideoConfig(); return ( <Solid width={width} height={height} effects={[ lightLeak({ progress: interpolate(frame, [0, durationInFrames - 1], [0, 1], { extrapolateLeft: 'clamp', extrapolateRight: 'clamp', }), }), ]} /> ); }; <TransitionSeries> <TransitionSeries.Sequence durationInFrames={60}> <SceneA /> </TransitionSeries.Sequence> <TransitionSeries.Overlay durationInFrames={20}> <LightLeakOverlay /> </TransitionSeries.Overlay> <TransitionSeries.Sequence durationInFrames={60}> <SceneB /> </TransitionSeries.Sequence> </TransitionSeries>; ``` ## Mixing transitions and overlays Transitions and overlays can coexist in the same `<TransitionSeries>`, but an overlay cannot be adjacent to a transition or another overlay. ```tsx import {lightLeak} from '@remotion/effects/light-leak'; import {TransitionSeries, linearTiming} from '@remotion/transitions'; import {fade} from '@remotion/transitions/fade'; import {interpolate, Solid, useCurrentFrame, useVideoConfig} from 'remotion'; const LightLeakOverlay: React.FC = () => { const frame = useCurrentFrame(); const {durationInFrames, height, width} = useVideoConfig(); return ( <Solid width={width} height={height} effects={[ lightLeak({ progress: interpolate(frame, [0, durationInFrames - 1], [0, 1], { extrapolateLeft: 'clamp', extrapolateRight: 'clamp', }), }), ]} /> ); }; <TransitionSeries> <TransitionSeries.Sequence durationInFrames={60}> <SceneA /> </TransitionSeries.Sequence> <TransitionSeries.Overlay durationInFrames={30}> <LightLeakOverlay /> </TransitionSeries.Overlay> <TransitionSeries.Sequence durationInFrames={60}> <SceneB /> </TransitionSeries.Sequence> <TransitionSeries.Transition presentation={fade()} timing={linearTiming({ durationInFrames: 15 })} /> <TransitionSeries.Sequence durationInFrames={60}> <SceneC /> </TransitionSeries.Sequence> </TransitionSeries>; ``` ## Transition props `<TransitionSeries.Transition>` requires: - `presentation` — the visual effect (e.g. `fade()`, `slide()`, `wipe()`). - `timing` — controls speed and easing (e.g. `linearTiming()`, `springTiming()`). ## Overlay props `<TransitionSeries.Overlay>` accepts: - `durationInFrames` — how long the overlay is visible (positive integer). - `offset?` — shifts the overlay relative to the cut point center. Positive = later, negative = earlier. Default: `0`. ## Available transition types Import transitions from their respective modules: ```tsx import { fade } from "@remotion/transitions/fade"; import { slide } from "@remotion/transitions/slide"; import { wipe } from "@remotion/transitions/wipe"; import { flip } from "@remotion/transitions/flip"; import { clockWipe } from "@remotion/transitions/clock-wipe"; ``` ## Slide transition with direction ```tsx import { slide } from "@remotion/transitions/slide"; <TransitionSeries.Transition presentation={slide({ direction: "from-left" })} timing={linearTiming({ durationInFrames: 20 })} />; ``` Directions: `"from-left"`, `"from-right"`, `"from-top"`, `"from-bottom"` ## Timing options ```tsx import { linearTiming, springTiming } from "@remotion/transitions"; // Linear timing - constant speed linearTiming({ durationInFrames: 20 }); // Spring timing - organic motion springTiming({ config: { damping: 200 }, durationInFrames: 25 }); ``` ## Duration calculation Transitions overlap adjacent scenes, so the total composition length is **shorter** than the sum of all sequence durations. Overlays do **not** affect the total duration. For example, with two 60-frame sequences and a 15-frame transition: - Without transitions: `60 + 60 = 120` frames - With transition: `60 + 60 - 15 = 105` frames Adding an overlay between two other sequences does not change the total. ### Getting the duration of a transition Use the `getDurationInFrames()` method on the timing object: ```tsx import { linearTiming, springTiming } from "@remotion/transitions"; const linearDuration = linearTiming({ durationInFrames: 20, }).getDurationInFrames({ fps: 30 }); // Returns 20 const springDuration = springTiming({ config: { damping: 200 }, }).getDurationInFrames({ fps: 30 }); // Returns calculated duration based on spring physics ``` For `springTiming` without an explicit `durationInFrames`, the duration depends on `fps` because it calculates when the spring animation settles. ### Calculating total composition duration ```tsx import { linearTiming } from "@remotion/transitions"; const scene1Duration = 60; const scene2Duration = 60; const scene3Duration = 60; const timing1 = linearTiming({ durationInFrames: 15 }); const timing2 = linearTiming({ durationInFrames: 20 }); const transition1Duration = timing1.getDurationInFrames({ fps: 30 }); const transition2Duration = timing2.getDurationInFrames({ fps: 30 }); const totalDuration = scene1Duration + scene2Duration + scene3Duration - transition1Duration - transition2Duration; // 60 + 60 + 60 - 15 - 20 = 145 frames ``` -
video-editing.md 3.3 KB
Remotion can be used for bare-bones video editing in the Studio. Choose the source structure based on the editing behavior you want: - Use independently positioned clips when moving or resizing one clip should not affect any other clip. - Use ripple editing when changing one clip's duration should reposition every clip after it. Keep every editable clip as its own authored JSX node. Do not generate editable clips with `.map()` or another programmatic loop. ## Independently positioned clips Place every `<Video>` directly in the composition and hardcode its timing props. `from={0}` may be omitted: ```tsx <Video src="https://remotion.media/video.mp4" trimBefore={0} durationInFrames={78} /> <Video src="https://remotion.media/video.webm" trimBefore={12} from={78} durationInFrames={66} /> <Video src="https://remotion.media/video.mp4" trimBefore={72} from={144} durationInFrames={90} /> <Video src="https://remotion.media/video.webm" trimBefore={58} from={234} durationInFrames={72} /> <Video src="https://remotion.media/video.mp4" trimBefore={180} from={306} durationInFrames={60} /> ``` - `from` is the clip's absolute start frame in its parent timeline. - `durationInFrames` is how many frames the clip remains visible. - `trimBefore` is how many source frames are skipped before playback begins. - Each `<Video>` must be a separate JSX node. Add a descriptive `name` when useful in the Studio timeline. - `from`, `durationInFrames`, and `trimBefore` must be hardcoded frame values. Do not compute them. - Import `<Video>` from `@remotion/media`. Moving or resizing one of these clips does not reposition later clips. Gaps and overlaps are therefore allowed. ## Ripple editing with `TransitionSeries` “Ripple editing” is the standard video-editing term for changing one clip and automatically shifting everything after it. In Remotion, a `<TransitionSeries>` provides this sequential, cascading timing model while also allowing transitions between clips. Read [transitions.md](transitions.md) for transition types, timing options, installation instructions, and composition-duration calculation. Keep the markup like this: ```tsx <TransitionSeries name="Video timeline"> <TransitionSeries.Sequence name="Clip 1" durationInFrames={39}> <Video src="https://remotion.media/video.mp4" trimBefore={0} /> </TransitionSeries.Sequence> <TransitionSeries.Sequence name="Clip 2" durationInFrames={45}> <Video src="https://remotion.media/video.webm" trimBefore={8} /> </TransitionSeries.Sequence> <TransitionSeries.Sequence name="Clip 3" durationInFrames={43}> <Video src="https://remotion.media/video.mp4" trimBefore={60} /> </TransitionSeries.Sequence> </TransitionSeries> ``` - The `<TransitionSeries.Sequence>` is the editable clip row in the Studio timeline. - Dragging its right edge changes `durationInFrames` and repositions every later sequence. - Do not set `from` on `<TransitionSeries.Sequence>`; the series calculates each start frame. - Hardcode all numeric values. - Do not programmatically create multiple `<TransitionSeries.Sequence>` (no `.map`). Each instance must be hard-coded. - Import `<Video>` from `@remotion/media`. Import `<TransitionSeries>` from `@remotion/transitions`. If needing to install: `npx remotion add @remotion/media @remotion/transitions` -
voiceover.md 3.2 KB
--- name: voiceover description: Adding AI-generated voiceover to Remotion compositions using TTS metadata: tags: voiceover, audio, elevenlabs, tts, speech, calculateMetadata, dynamic duration --- # Adding AI voiceover to a Remotion composition Use ElevenLabs TTS to generate speech audio per scene, then use [`calculateMetadata`](./calculate-metadata.md) to dynamically size the composition to match the audio. ## Prerequisites By default this guide uses **ElevenLabs** as the TTS provider (`ELEVENLABS_API_KEY` environment variable). Users may substitute any TTS service that can produce an audio file. If the user has not specified a TTS provider, recommend ElevenLabs and ask for their API key. Ensure the environment variable is available when running the generation script: ```bash node --strip-types generate-voiceover.ts ``` ## Generating audio with ElevenLabs Create a script that reads the config, calls the ElevenLabs API for each scene, and writes MP3 files to the `public/` directory so Remotion can access them via `staticFile()`. The core API call for a single scene: ```ts title="generate-voiceover.ts" const response = await fetch( `https://api.elevenlabs.io/v1/text-to-speech/${voiceId}`, { method: "POST", headers: { "xi-api-key": process.env.ELEVENLABS_API_KEY!, "Content-Type": "application/json", Accept: "audio/mpeg", }, body: JSON.stringify({ text: "Welcome to the show.", model_id: "eleven_multilingual_v2", voice_settings: { stability: 0.5, similarity_boost: 0.75, style: 0.3, }, }), }, ); const audioBuffer = Buffer.from(await response.arrayBuffer()); writeFileSync(`public/voiceover/${compositionId}/${scene.id}.mp3`, audioBuffer); ``` ## Dynamic composition duration with calculateMetadata Use [`calculateMetadata`](./calculate-metadata.md) to measure the audio durations and set the composition length accordingly. ```tsx import { CalculateMetadataFunction, staticFile } from "remotion"; import { getAudioDuration } from "./get-audio-duration"; const FPS = 30; const SCENE_AUDIO_FILES = [ "voiceover/my-comp/scene-01-intro.mp3", "voiceover/my-comp/scene-02-main.mp3", "voiceover/my-comp/scene-03-outro.mp3", ]; export const calculateMetadata: CalculateMetadataFunction<Props> = async ({ props, }) => { const durations = await Promise.all( SCENE_AUDIO_FILES.map((file) => getAudioDuration(staticFile(file))), ); const sceneDurations = durations.map((durationInSeconds) => { return durationInSeconds * FPS; }); return { durationInFrames: Math.ceil(sceneDurations.reduce((sum, d) => sum + d, 0)), }; }; ``` The computed `sceneDurations` are passed into the component via a `voiceover` prop so the component knows how long each scene should be. If the composition uses [`<TransitionSeries>`](./transitions.md), subtract the overlap from total duration: [./transitions.md#calculating-total-composition-duration](./transitions.md#calculating-total-composition-duration) ## Rendering audio in the component See [audio.md](./audio.md) for more information on how to render audio in the component. ## Delaying audio start See [audio.md#delaying](./audio.md#delaying) for more information on how to delay the audio start.
Comments (0)
Sign in to join the conversation.
Reviews (0)
No reviews yet.
No comments yet.