dsh-remotion 0.3.4 → 0.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +21 -0
- package/README.en.md +26 -65
- package/README.md +25 -67
- package/docs/USAGE.en.md +93 -0
- package/docs/USAGE.md +97 -0
- package/docs/VALIDATION.md +22 -0
- package/lib/client.js +90 -0
- package/lib/index.d.ts +3 -0
- package/lib/index.js +5 -1
- package/lib/media-store.d.ts +25 -0
- package/lib/media-store.js +174 -0
- package/lib/media-templates.d.ts +52 -0
- package/lib/media-templates.js +91 -0
- package/lib/media-workbench.d.ts +42 -0
- package/lib/media-workbench.js +476 -0
- package/package.json +18 -5
- package/scripts/build-client.mjs +4 -0
- package/skills/remotion-best-practices/SKILL.md +54 -54
- package/skills/remotion-best-practices/agents/openai.yaml +7 -7
- package/skills/remotion-best-practices/assets/remotion-icon.svg +4 -4
- package/skills/remotion-best-practices/remotion-captions/REFERENCE.md +36 -36
- package/skills/remotion-best-practices/remotion-captions/agents/openai.yaml +7 -7
- package/skills/remotion-best-practices/remotion-captions/assets/remotion-icon.svg +4 -4
- package/skills/remotion-best-practices/remotion-captions/display-captions.md +190 -190
- package/skills/remotion-best-practices/remotion-captions/import-srt-captions.md +73 -73
- package/skills/remotion-best-practices/remotion-captions/transcribe-captions.md +70 -70
- package/skills/remotion-best-practices/remotion-create/REFERENCE.md +85 -85
- package/skills/remotion-best-practices/remotion-create/agents/openai.yaml +7 -7
- package/skills/remotion-best-practices/remotion-create/assets/remotion-icon.svg +4 -4
- package/skills/remotion-best-practices/remotion-create/tailwind.md +11 -11
- package/skills/remotion-best-practices/remotion-create/video-layout.md +9 -9
- package/skills/remotion-best-practices/remotion-docs/REFERENCE.md +46 -46
- package/skills/remotion-best-practices/remotion-docs/agents/openai.yaml +7 -7
- package/skills/remotion-best-practices/remotion-docs/assets/remotion-icon.svg +4 -4
- package/skills/remotion-best-practices/remotion-interactivity/REFERENCE.md +315 -315
- package/skills/remotion-best-practices/remotion-interactivity/agents/openai.yaml +7 -7
- package/skills/remotion-best-practices/remotion-interactivity/assets/remotion-icon.svg +4 -4
- package/skills/remotion-best-practices/remotion-maps/REFERENCE.md +36 -36
- package/skills/remotion-best-practices/remotion-maps/agents/openai.yaml +7 -7
- package/skills/remotion-best-practices/remotion-maps/assets/remotion-icon.svg +4 -4
- package/skills/remotion-best-practices/remotion-maps/techniques/cesium/TECHNIQUE.md +89 -89
- package/skills/remotion-best-practices/remotion-maps/techniques/cesium/assets/CesiumFlythrough.tsx +284 -284
- package/skills/remotion-best-practices/remotion-maps/techniques/cesium/assets/cesium-path.json +299 -299
- package/skills/remotion-best-practices/remotion-maps/techniques/cesium/assets/city-path.json +12 -12
- package/skills/remotion-best-practices/remotion-maps/techniques/cesium/assets/example-Root.tsx +39 -39
- package/skills/remotion-best-practices/remotion-maps/techniques/cesium/assets/flight-path.ts +35 -35
- package/skills/remotion-best-practices/remotion-maps/techniques/cesium/assets/sample-river.geojson +215 -215
- package/skills/remotion-best-practices/remotion-maps/techniques/cesium/references/3d-data-sources.md +43 -43
- package/skills/remotion-best-practices/remotion-maps/techniques/cesium/references/3d-flyover-architecture.md +128 -128
- package/skills/remotion-best-practices/remotion-maps/techniques/cesium/references/3d-troubleshooting.md +57 -57
- package/skills/remotion-best-practices/remotion-maps/techniques/cesium/scripts/prep-cesium-path.mjs +161 -161
- package/skills/remotion-best-practices/remotion-maps/techniques/mapbox/TECHNIQUE.md +449 -449
- package/skills/remotion-best-practices/remotion-maps/techniques/mapbox/references/render-stability.md +64 -64
- package/skills/remotion-best-practices/remotion-maps/techniques/maplibre/TECHNIQUE.md +484 -484
- package/skills/remotion-best-practices/remotion-maps/techniques/maplibre/references/render-stability.md +64 -64
- package/skills/remotion-best-practices/remotion-maps/techniques/maptiler/TECHNIQUE.md +80 -80
- package/skills/remotion-best-practices/remotion-maps/techniques/maptiler/assets/CountryLabel.tsx +70 -70
- package/skills/remotion-best-practices/remotion-maps/techniques/maptiler/assets/MapTilerVectorElement.ts +80 -80
- package/skills/remotion-best-practices/remotion-maps/techniques/maptiler/assets/RiverReveal.tsx +363 -363
- package/skills/remotion-best-practices/remotion-maps/techniques/maptiler/assets/example-Root.tsx +22 -22
- package/skills/remotion-best-practices/remotion-maps/techniques/maptiler/assets/sample-data/country-meta.json +7535 -7535
- package/skills/remotion-best-practices/remotion-maps/techniques/maptiler/assets/sample-data/yarlung-flow.json +605 -605
- package/skills/remotion-best-practices/remotion-maps/techniques/maptiler/assets/tokens.ts +34 -34
- package/skills/remotion-best-practices/remotion-maps/techniques/maptiler/references/map-data-sources.md +91 -91
- package/skills/remotion-best-practices/remotion-maps/techniques/maptiler/references/map-explainer-architecture.md +129 -129
- package/skills/remotion-best-practices/remotion-maps/techniques/maptiler/references/map-geo-prep.md +85 -85
- package/skills/remotion-best-practices/remotion-maps/techniques/maptiler/references/render-stability.md +64 -64
- package/skills/remotion-best-practices/remotion-maps/techniques/maptiler/scripts/prep-geo.mjs +202 -202
- package/skills/remotion-best-practices/remotion-maps/techniques/static-map/TECHNIQUE.md +37 -37
- package/skills/remotion-best-practices/remotion-markup/3d.md +86 -86
- package/skills/remotion-best-practices/remotion-markup/REFERENCE.md +358 -358
- package/skills/remotion-best-practices/remotion-markup/agents/openai.yaml +7 -7
- package/skills/remotion-best-practices/remotion-markup/assets/remotion-icon.svg +4 -4
- package/skills/remotion-best-practices/remotion-markup/audio-visualization.md +198 -198
- package/skills/remotion-best-practices/remotion-markup/audio.md +169 -169
- package/skills/remotion-best-practices/remotion-markup/calculate-metadata.md +136 -136
- package/skills/remotion-best-practices/remotion-markup/compositions.md +123 -123
- package/skills/remotion-best-practices/remotion-markup/connected-compositions.md +79 -79
- package/skills/remotion-best-practices/remotion-markup/cropping.md +34 -34
- package/skills/remotion-best-practices/remotion-markup/effects.md +251 -251
- package/skills/remotion-best-practices/remotion-markup/embedding-videos.md +171 -171
- package/skills/remotion-best-practices/remotion-markup/ffmpeg.md +38 -38
- package/skills/remotion-best-practices/remotion-markup/gifs.md +187 -187
- package/skills/remotion-best-practices/remotion-markup/google-fonts.md +76 -76
- package/skills/remotion-best-practices/remotion-markup/html-in-canvas.md +128 -128
- package/skills/remotion-best-practices/remotion-markup/images.md +73 -73
- package/skills/remotion-best-practices/remotion-markup/light-leaks.md +106 -106
- package/skills/remotion-best-practices/remotion-markup/local-fonts.md +69 -69
- package/skills/remotion-best-practices/remotion-markup/lottie.md +73 -73
- package/skills/remotion-best-practices/remotion-markup/measuring-dom-nodes.md +38 -38
- package/skills/remotion-best-practices/remotion-markup/measuring-text.md +146 -146
- package/skills/remotion-best-practices/remotion-markup/motion-blur.md +60 -60
- package/skills/remotion-best-practices/remotion-markup/multi-scene-video.md +81 -81
- package/skills/remotion-best-practices/remotion-markup/parameters.md +111 -111
- package/skills/remotion-best-practices/remotion-markup/remotion-maps/REFERENCE.md +36 -36
- package/skills/remotion-best-practices/remotion-markup/remotion-maps/agents/openai.yaml +7 -7
- package/skills/remotion-best-practices/remotion-markup/remotion-maps/assets/remotion-icon.svg +4 -4
- package/skills/remotion-best-practices/remotion-markup/remotion-maps/techniques/cesium/TECHNIQUE.md +89 -89
- package/skills/remotion-best-practices/remotion-markup/remotion-maps/techniques/cesium/assets/CesiumFlythrough.tsx +284 -284
- package/skills/remotion-best-practices/remotion-markup/remotion-maps/techniques/cesium/assets/cesium-path.json +299 -299
- package/skills/remotion-best-practices/remotion-markup/remotion-maps/techniques/cesium/assets/city-path.json +12 -12
- package/skills/remotion-best-practices/remotion-markup/remotion-maps/techniques/cesium/assets/example-Root.tsx +39 -39
- package/skills/remotion-best-practices/remotion-markup/remotion-maps/techniques/cesium/assets/flight-path.ts +35 -35
- package/skills/remotion-best-practices/remotion-markup/remotion-maps/techniques/cesium/assets/sample-river.geojson +215 -215
- package/skills/remotion-best-practices/remotion-markup/remotion-maps/techniques/cesium/references/3d-data-sources.md +43 -43
- package/skills/remotion-best-practices/remotion-markup/remotion-maps/techniques/cesium/references/3d-flyover-architecture.md +128 -128
- package/skills/remotion-best-practices/remotion-markup/remotion-maps/techniques/cesium/references/3d-troubleshooting.md +57 -57
- package/skills/remotion-best-practices/remotion-markup/remotion-maps/techniques/cesium/scripts/prep-cesium-path.mjs +161 -161
- package/skills/remotion-best-practices/remotion-markup/remotion-maps/techniques/mapbox/TECHNIQUE.md +449 -449
- package/skills/remotion-best-practices/remotion-markup/remotion-maps/techniques/mapbox/references/render-stability.md +64 -64
- package/skills/remotion-best-practices/remotion-markup/remotion-maps/techniques/maplibre/TECHNIQUE.md +484 -484
- package/skills/remotion-best-practices/remotion-markup/remotion-maps/techniques/maplibre/references/render-stability.md +64 -64
- package/skills/remotion-best-practices/remotion-markup/remotion-maps/techniques/maptiler/TECHNIQUE.md +80 -80
- package/skills/remotion-best-practices/remotion-markup/remotion-maps/techniques/maptiler/assets/CountryLabel.tsx +70 -70
- package/skills/remotion-best-practices/remotion-markup/remotion-maps/techniques/maptiler/assets/MapTilerVectorElement.ts +80 -80
- package/skills/remotion-best-practices/remotion-markup/remotion-maps/techniques/maptiler/assets/RiverReveal.tsx +363 -363
- package/skills/remotion-best-practices/remotion-markup/remotion-maps/techniques/maptiler/assets/example-Root.tsx +22 -22
- package/skills/remotion-best-practices/remotion-markup/remotion-maps/techniques/maptiler/assets/sample-data/country-meta.json +7535 -7535
- package/skills/remotion-best-practices/remotion-markup/remotion-maps/techniques/maptiler/assets/sample-data/yarlung-flow.json +605 -605
- package/skills/remotion-best-practices/remotion-markup/remotion-maps/techniques/maptiler/assets/tokens.ts +34 -34
- package/skills/remotion-best-practices/remotion-markup/remotion-maps/techniques/maptiler/references/map-data-sources.md +91 -91
- package/skills/remotion-best-practices/remotion-markup/remotion-maps/techniques/maptiler/references/map-explainer-architecture.md +129 -129
- package/skills/remotion-best-practices/remotion-markup/remotion-maps/techniques/maptiler/references/map-geo-prep.md +85 -85
- package/skills/remotion-best-practices/remotion-markup/remotion-maps/techniques/maptiler/references/render-stability.md +64 -64
- package/skills/remotion-best-practices/remotion-markup/remotion-maps/techniques/maptiler/scripts/prep-geo.mjs +202 -202
- package/skills/remotion-best-practices/remotion-markup/remotion-maps/techniques/static-map/TECHNIQUE.md +37 -37
- package/skills/remotion-best-practices/remotion-markup/sequencing.md +169 -169
- package/skills/remotion-best-practices/remotion-markup/sfx.md +51 -51
- package/skills/remotion-best-practices/remotion-markup/silence-detection.md +71 -71
- package/skills/remotion-best-practices/remotion-markup/text-highlights.md +56 -56
- package/skills/remotion-best-practices/remotion-markup/timing.md +111 -111
- package/skills/remotion-best-practices/remotion-markup/transitions.md +239 -239
- package/skills/remotion-best-practices/remotion-markup/video-editing.md +90 -90
- package/skills/remotion-best-practices/remotion-markup/voiceover.md +99 -99
- package/skills/remotion-best-practices/remotion-multimedia/REFERENCE.md +20 -20
- package/skills/remotion-best-practices/remotion-multimedia/agents/openai.yaml +7 -7
- package/skills/remotion-best-practices/remotion-multimedia/assets/remotion-icon.svg +4 -4
- package/skills/remotion-best-practices/remotion-multimedia/get-audio-duration.md +56 -56
- package/skills/remotion-best-practices/remotion-multimedia/get-video-dimensions.md +66 -66
- package/skills/remotion-best-practices/remotion-multimedia/get-video-duration.md +58 -58
- package/skills/remotion-best-practices/remotion-render/REFERENCE.md +35 -35
- package/skills/remotion-best-practices/remotion-render/agents/openai.yaml +7 -7
- package/skills/remotion-best-practices/remotion-render/assets/remotion-icon.svg +4 -4
- package/skills/remotion-best-practices/remotion-render/transparent-videos.md +106 -106
- package/skills/remotion-best-practices/remotion-saas/REFERENCE.md +33 -33
- package/skills/remotion-best-practices/remotion-saas/agents/openai.yaml +7 -7
- package/skills/remotion-best-practices/remotion-saas/assets/remotion-icon.svg +4 -4
- package/skills/remotion-best-practices/remotion-saas/framework.md +19 -19
- package/skills/remotion-best-practices/remotion-saas/player.md +33 -33
- package/skills/remotion-best-practices/remotion-saas/rendering.md +69 -69
- package/skills/remotion-best-practices/remotion-studio/REFERENCE.md +24 -24
- package/skills/remotion-best-practices/remotion-studio/agents/openai.yaml +7 -7
- package/skills/remotion-best-practices/remotion-studio/assets/remotion-icon.svg +4 -4
- package/skills/remotion-best-practices/remotion-upgrade/REFERENCE.md +31 -31
- package/skills/remotion-best-practices/remotion-upgrade/agents/openai.yaml +7 -7
- package/skills/remotion-best-practices/remotion-upgrade/assets/remotion-icon.svg +4 -4
- package/skills/remotion-captions/SKILL.md +31 -31
- package/skills/remotion-captions/agents/openai.yaml +7 -7
- package/skills/remotion-captions/assets/remotion-icon.svg +4 -4
- package/skills/remotion-captions/display-captions.md +190 -190
- package/skills/remotion-captions/import-srt-captions.md +73 -73
- package/skills/remotion-captions/transcribe-captions.md +70 -70
- package/skills/remotion-create/SKILL.md +80 -80
- package/skills/remotion-create/agents/openai.yaml +7 -7
- package/skills/remotion-create/assets/remotion-icon.svg +4 -4
- package/skills/remotion-create/tailwind.md +11 -11
- package/skills/remotion-create/video-layout.md +9 -9
- package/skills/remotion-docs/SKILL.md +41 -41
- package/skills/remotion-docs/agents/openai.yaml +7 -7
- package/skills/remotion-docs/assets/remotion-icon.svg +4 -4
- package/skills/remotion-interactivity/SKILL.md +310 -310
- package/skills/remotion-interactivity/agents/openai.yaml +7 -7
- package/skills/remotion-interactivity/assets/remotion-icon.svg +4 -4
- package/skills/remotion-maps/SKILL.md +31 -31
- package/skills/remotion-maps/agents/openai.yaml +7 -7
- package/skills/remotion-maps/assets/remotion-icon.svg +4 -4
- package/skills/remotion-maps/techniques/cesium/TECHNIQUE.md +89 -89
- package/skills/remotion-maps/techniques/cesium/assets/CesiumFlythrough.tsx +284 -284
- package/skills/remotion-maps/techniques/cesium/assets/cesium-path.json +299 -299
- package/skills/remotion-maps/techniques/cesium/assets/city-path.json +12 -12
- package/skills/remotion-maps/techniques/cesium/assets/example-Root.tsx +39 -39
- package/skills/remotion-maps/techniques/cesium/assets/flight-path.ts +35 -35
- package/skills/remotion-maps/techniques/cesium/assets/sample-river.geojson +215 -215
- package/skills/remotion-maps/techniques/cesium/references/3d-data-sources.md +43 -43
- package/skills/remotion-maps/techniques/cesium/references/3d-flyover-architecture.md +128 -128
- package/skills/remotion-maps/techniques/cesium/references/3d-troubleshooting.md +57 -57
- package/skills/remotion-maps/techniques/cesium/scripts/prep-cesium-path.mjs +161 -161
- package/skills/remotion-maps/techniques/mapbox/TECHNIQUE.md +449 -449
- package/skills/remotion-maps/techniques/mapbox/references/render-stability.md +64 -64
- package/skills/remotion-maps/techniques/maplibre/TECHNIQUE.md +484 -484
- package/skills/remotion-maps/techniques/maplibre/references/render-stability.md +64 -64
- package/skills/remotion-maps/techniques/maptiler/TECHNIQUE.md +80 -80
- package/skills/remotion-maps/techniques/maptiler/assets/CountryLabel.tsx +70 -70
- package/skills/remotion-maps/techniques/maptiler/assets/MapTilerVectorElement.ts +80 -80
- package/skills/remotion-maps/techniques/maptiler/assets/RiverReveal.tsx +363 -363
- package/skills/remotion-maps/techniques/maptiler/assets/example-Root.tsx +22 -22
- package/skills/remotion-maps/techniques/maptiler/assets/sample-data/country-meta.json +7535 -7535
- package/skills/remotion-maps/techniques/maptiler/assets/sample-data/yarlung-flow.json +605 -605
- package/skills/remotion-maps/techniques/maptiler/assets/tokens.ts +34 -34
- package/skills/remotion-maps/techniques/maptiler/references/map-data-sources.md +91 -91
- package/skills/remotion-maps/techniques/maptiler/references/map-explainer-architecture.md +129 -129
- package/skills/remotion-maps/techniques/maptiler/references/map-geo-prep.md +85 -85
- package/skills/remotion-maps/techniques/maptiler/references/render-stability.md +64 -64
- package/skills/remotion-maps/techniques/maptiler/scripts/prep-geo.mjs +202 -202
- package/skills/remotion-maps/techniques/static-map/TECHNIQUE.md +37 -37
- package/skills/remotion-markup/3d.md +86 -86
- package/skills/remotion-markup/SKILL.md +353 -353
- package/skills/remotion-markup/agents/openai.yaml +7 -7
- package/skills/remotion-markup/assets/remotion-icon.svg +4 -4
- package/skills/remotion-markup/audio-visualization.md +198 -198
- package/skills/remotion-markup/audio.md +169 -169
- package/skills/remotion-markup/calculate-metadata.md +136 -136
- package/skills/remotion-markup/compositions.md +123 -123
- package/skills/remotion-markup/connected-compositions.md +79 -79
- package/skills/remotion-markup/cropping.md +34 -34
- package/skills/remotion-markup/effects.md +251 -251
- package/skills/remotion-markup/embedding-videos.md +171 -171
- package/skills/remotion-markup/ffmpeg.md +38 -38
- package/skills/remotion-markup/gifs.md +187 -187
- package/skills/remotion-markup/google-fonts.md +76 -76
- package/skills/remotion-markup/html-in-canvas.md +128 -128
- package/skills/remotion-markup/images.md +73 -73
- package/skills/remotion-markup/light-leaks.md +106 -106
- package/skills/remotion-markup/local-fonts.md +69 -69
- package/skills/remotion-markup/lottie.md +73 -73
- package/skills/remotion-markup/measuring-dom-nodes.md +38 -38
- package/skills/remotion-markup/measuring-text.md +146 -146
- package/skills/remotion-markup/motion-blur.md +60 -60
- package/skills/remotion-markup/multi-scene-video.md +81 -81
- package/skills/remotion-markup/parameters.md +111 -111
- package/skills/remotion-markup/remotion-maps/REFERENCE.md +36 -36
- package/skills/remotion-markup/remotion-maps/agents/openai.yaml +7 -7
- package/skills/remotion-markup/remotion-maps/assets/remotion-icon.svg +4 -4
- package/skills/remotion-markup/remotion-maps/techniques/cesium/TECHNIQUE.md +89 -89
- package/skills/remotion-markup/remotion-maps/techniques/cesium/assets/CesiumFlythrough.tsx +284 -284
- package/skills/remotion-markup/remotion-maps/techniques/cesium/assets/cesium-path.json +299 -299
- package/skills/remotion-markup/remotion-maps/techniques/cesium/assets/city-path.json +12 -12
- package/skills/remotion-markup/remotion-maps/techniques/cesium/assets/example-Root.tsx +39 -39
- package/skills/remotion-markup/remotion-maps/techniques/cesium/assets/flight-path.ts +35 -35
- package/skills/remotion-markup/remotion-maps/techniques/cesium/assets/sample-river.geojson +215 -215
- package/skills/remotion-markup/remotion-maps/techniques/cesium/references/3d-data-sources.md +43 -43
- package/skills/remotion-markup/remotion-maps/techniques/cesium/references/3d-flyover-architecture.md +128 -128
- package/skills/remotion-markup/remotion-maps/techniques/cesium/references/3d-troubleshooting.md +57 -57
- package/skills/remotion-markup/remotion-maps/techniques/cesium/scripts/prep-cesium-path.mjs +161 -161
- package/skills/remotion-markup/remotion-maps/techniques/mapbox/TECHNIQUE.md +449 -449
- package/skills/remotion-markup/remotion-maps/techniques/mapbox/references/render-stability.md +64 -64
- package/skills/remotion-markup/remotion-maps/techniques/maplibre/TECHNIQUE.md +484 -484
- package/skills/remotion-markup/remotion-maps/techniques/maplibre/references/render-stability.md +64 -64
- package/skills/remotion-markup/remotion-maps/techniques/maptiler/TECHNIQUE.md +80 -80
- package/skills/remotion-markup/remotion-maps/techniques/maptiler/assets/CountryLabel.tsx +70 -70
- package/skills/remotion-markup/remotion-maps/techniques/maptiler/assets/MapTilerVectorElement.ts +80 -80
- package/skills/remotion-markup/remotion-maps/techniques/maptiler/assets/RiverReveal.tsx +363 -363
- package/skills/remotion-markup/remotion-maps/techniques/maptiler/assets/example-Root.tsx +22 -22
- package/skills/remotion-markup/remotion-maps/techniques/maptiler/assets/sample-data/country-meta.json +7535 -7535
- package/skills/remotion-markup/remotion-maps/techniques/maptiler/assets/sample-data/yarlung-flow.json +605 -605
- package/skills/remotion-markup/remotion-maps/techniques/maptiler/assets/tokens.ts +34 -34
- package/skills/remotion-markup/remotion-maps/techniques/maptiler/references/map-data-sources.md +91 -91
- package/skills/remotion-markup/remotion-maps/techniques/maptiler/references/map-explainer-architecture.md +129 -129
- package/skills/remotion-markup/remotion-maps/techniques/maptiler/references/map-geo-prep.md +85 -85
- package/skills/remotion-markup/remotion-maps/techniques/maptiler/references/render-stability.md +64 -64
- package/skills/remotion-markup/remotion-maps/techniques/maptiler/scripts/prep-geo.mjs +202 -202
- package/skills/remotion-markup/remotion-maps/techniques/static-map/TECHNIQUE.md +37 -37
- package/skills/remotion-markup/sequencing.md +169 -169
- package/skills/remotion-markup/sfx.md +51 -51
- package/skills/remotion-markup/silence-detection.md +71 -71
- package/skills/remotion-markup/text-highlights.md +56 -56
- package/skills/remotion-markup/timing.md +111 -111
- package/skills/remotion-markup/transitions.md +239 -239
- package/skills/remotion-markup/video-editing.md +90 -90
- package/skills/remotion-markup/voiceover.md +99 -99
- package/skills/remotion-multimedia/SKILL.md +15 -15
- package/skills/remotion-multimedia/agents/openai.yaml +7 -7
- package/skills/remotion-multimedia/assets/remotion-icon.svg +4 -4
- package/skills/remotion-multimedia/get-audio-duration.md +56 -56
- package/skills/remotion-multimedia/get-video-dimensions.md +66 -66
- package/skills/remotion-multimedia/get-video-duration.md +58 -58
- package/skills/remotion-render/SKILL.md +30 -30
- package/skills/remotion-render/agents/openai.yaml +7 -7
- package/skills/remotion-render/assets/remotion-icon.svg +4 -4
- package/skills/remotion-render/transparent-videos.md +106 -106
- package/skills/remotion-saas/SKILL.md +28 -28
- package/skills/remotion-saas/agents/openai.yaml +7 -7
- package/skills/remotion-saas/assets/remotion-icon.svg +4 -4
- package/skills/remotion-saas/framework.md +19 -19
- package/skills/remotion-saas/player.md +33 -33
- package/skills/remotion-saas/rendering.md +69 -69
- package/skills/remotion-studio/SKILL.md +19 -19
- package/skills/remotion-studio/agents/openai.yaml +7 -7
- package/skills/remotion-studio/assets/remotion-icon.svg +4 -4
- package/skills/remotion-upgrade/SKILL.md +26 -26
- package/skills/remotion-upgrade/agents/openai.yaml +7 -7
- package/skills/remotion-upgrade/assets/remotion-icon.svg +4 -4
- package/templates/DESIGN.md +26 -0
|
@@ -1,69 +1,69 @@
|
|
|
1
|
-
For local font files, use the `@remotion/fonts` package.
|
|
2
|
-
|
|
3
|
-
### Prerequisites
|
|
4
|
-
|
|
5
|
-
First, install @remotion/fonts:
|
|
6
|
-
|
|
7
|
-
```bash
|
|
8
|
-
npx remotion add @remotion/fonts # If project uses npm
|
|
9
|
-
bunx remotion add @remotion/fonts # If project uses bun
|
|
10
|
-
yarn remotion add @remotion/fonts # If project uses yarn
|
|
11
|
-
pnpm exec remotion add @remotion/fonts # If project uses pnpm
|
|
12
|
-
```
|
|
13
|
-
|
|
14
|
-
### Loading a local font
|
|
15
|
-
|
|
16
|
-
Place your font file in the `public/` folder and use `loadFont()`:
|
|
17
|
-
|
|
18
|
-
```tsx
|
|
19
|
-
import { loadFont } from "@remotion/fonts";
|
|
20
|
-
import { staticFile } from "remotion";
|
|
21
|
-
|
|
22
|
-
await loadFont({
|
|
23
|
-
family: "MyFont",
|
|
24
|
-
url: staticFile("MyFont-Regular.woff2"),
|
|
25
|
-
});
|
|
26
|
-
|
|
27
|
-
export const MyComposition = () => {
|
|
28
|
-
return (
|
|
29
|
-
<div style={{ fontFamily: "MyFont" }}>
|
|
30
|
-
Hello World
|
|
31
|
-
</div>
|
|
32
|
-
);
|
|
33
|
-
};
|
|
34
|
-
```
|
|
35
|
-
|
|
36
|
-
### Loading multiple weights
|
|
37
|
-
|
|
38
|
-
Load each weight separately with the same family name:
|
|
39
|
-
|
|
40
|
-
```tsx
|
|
41
|
-
import { loadFont } from "@remotion/fonts";
|
|
42
|
-
import { staticFile } from "remotion";
|
|
43
|
-
|
|
44
|
-
await Promise.all([
|
|
45
|
-
loadFont({
|
|
46
|
-
family: "Inter",
|
|
47
|
-
url: staticFile("Inter-Regular.woff2"),
|
|
48
|
-
weight: "400",
|
|
49
|
-
}),
|
|
50
|
-
loadFont({
|
|
51
|
-
family: "Inter",
|
|
52
|
-
url: staticFile("Inter-Bold.woff2"),
|
|
53
|
-
weight: "700",
|
|
54
|
-
}),
|
|
55
|
-
]);
|
|
56
|
-
```
|
|
57
|
-
|
|
58
|
-
### Available options
|
|
59
|
-
|
|
60
|
-
```tsx
|
|
61
|
-
loadFont({
|
|
62
|
-
family: "MyFont", // Required: name to use in CSS
|
|
63
|
-
url: staticFile("font.woff2"), // Required: font file URL
|
|
64
|
-
format: "woff2", // Optional: auto-detected from extension
|
|
65
|
-
weight: "400", // Optional: font weight
|
|
66
|
-
style: "normal", // Optional: normal or italic
|
|
67
|
-
display: "block", // Optional: font-display behavior
|
|
68
|
-
});
|
|
69
|
-
```
|
|
1
|
+
For local font files, use the `@remotion/fonts` package.
|
|
2
|
+
|
|
3
|
+
### Prerequisites
|
|
4
|
+
|
|
5
|
+
First, install @remotion/fonts:
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
npx remotion add @remotion/fonts # If project uses npm
|
|
9
|
+
bunx remotion add @remotion/fonts # If project uses bun
|
|
10
|
+
yarn remotion add @remotion/fonts # If project uses yarn
|
|
11
|
+
pnpm exec remotion add @remotion/fonts # If project uses pnpm
|
|
12
|
+
```
|
|
13
|
+
|
|
14
|
+
### Loading a local font
|
|
15
|
+
|
|
16
|
+
Place your font file in the `public/` folder and use `loadFont()`:
|
|
17
|
+
|
|
18
|
+
```tsx
|
|
19
|
+
import { loadFont } from "@remotion/fonts";
|
|
20
|
+
import { staticFile } from "remotion";
|
|
21
|
+
|
|
22
|
+
await loadFont({
|
|
23
|
+
family: "MyFont",
|
|
24
|
+
url: staticFile("MyFont-Regular.woff2"),
|
|
25
|
+
});
|
|
26
|
+
|
|
27
|
+
export const MyComposition = () => {
|
|
28
|
+
return (
|
|
29
|
+
<div style={{ fontFamily: "MyFont" }}>
|
|
30
|
+
Hello World
|
|
31
|
+
</div>
|
|
32
|
+
);
|
|
33
|
+
};
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
### Loading multiple weights
|
|
37
|
+
|
|
38
|
+
Load each weight separately with the same family name:
|
|
39
|
+
|
|
40
|
+
```tsx
|
|
41
|
+
import { loadFont } from "@remotion/fonts";
|
|
42
|
+
import { staticFile } from "remotion";
|
|
43
|
+
|
|
44
|
+
await Promise.all([
|
|
45
|
+
loadFont({
|
|
46
|
+
family: "Inter",
|
|
47
|
+
url: staticFile("Inter-Regular.woff2"),
|
|
48
|
+
weight: "400",
|
|
49
|
+
}),
|
|
50
|
+
loadFont({
|
|
51
|
+
family: "Inter",
|
|
52
|
+
url: staticFile("Inter-Bold.woff2"),
|
|
53
|
+
weight: "700",
|
|
54
|
+
}),
|
|
55
|
+
]);
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
### Available options
|
|
59
|
+
|
|
60
|
+
```tsx
|
|
61
|
+
loadFont({
|
|
62
|
+
family: "MyFont", // Required: name to use in CSS
|
|
63
|
+
url: staticFile("font.woff2"), // Required: font file URL
|
|
64
|
+
format: "woff2", // Optional: auto-detected from extension
|
|
65
|
+
weight: "400", // Optional: font weight
|
|
66
|
+
style: "normal", // Optional: normal or italic
|
|
67
|
+
display: "block", // Optional: font-display behavior
|
|
68
|
+
});
|
|
69
|
+
```
|
|
@@ -1,73 +1,73 @@
|
|
|
1
|
-
---
|
|
2
|
-
name: lottie
|
|
3
|
-
description: Embedding Lottie animations in Remotion.
|
|
4
|
-
metadata:
|
|
5
|
-
category: Animation
|
|
6
|
-
---
|
|
7
|
-
|
|
8
|
-
# Using Lottie Animations in Remotion
|
|
9
|
-
|
|
10
|
-
## Prerequisites
|
|
11
|
-
|
|
12
|
-
First, the @remotion/lottie package needs to be installed.
|
|
13
|
-
If it is not, use the following command:
|
|
14
|
-
|
|
15
|
-
```bash
|
|
16
|
-
npx remotion add @remotion/lottie # If project uses npm
|
|
17
|
-
bunx remotion add @remotion/lottie # If project uses bun
|
|
18
|
-
yarn remotion add @remotion/lottie # If project uses yarn
|
|
19
|
-
pnpm exec remotion add @remotion/lottie # If project uses pnpm
|
|
20
|
-
```
|
|
21
|
-
|
|
22
|
-
## Displaying a Lottie file
|
|
23
|
-
|
|
24
|
-
To import a Lottie animation:
|
|
25
|
-
|
|
26
|
-
- Fetch the Lottie asset
|
|
27
|
-
- Wrap the loading process in `delayRender()` and `continueRender()`
|
|
28
|
-
- Save the animation data in a state
|
|
29
|
-
- Render the Lottie animation using the `Lottie` component from the `@remotion/lottie` package
|
|
30
|
-
|
|
31
|
-
```tsx
|
|
32
|
-
import { Lottie, LottieAnimationData } from "@remotion/lottie";
|
|
33
|
-
import { useEffect, useState } from "react";
|
|
34
|
-
import { cancelRender, continueRender, delayRender } from "remotion";
|
|
35
|
-
|
|
36
|
-
export const MyAnimation = () => {
|
|
37
|
-
const [handle] = useState(() => delayRender("Loading Lottie animation"));
|
|
38
|
-
|
|
39
|
-
const [animationData, setAnimationData] =
|
|
40
|
-
useState<LottieAnimationData | null>(null);
|
|
41
|
-
|
|
42
|
-
useEffect(() => {
|
|
43
|
-
fetch("https://assets4.lottiefiles.com/packages/lf20_zyquagfl.json")
|
|
44
|
-
.then((data) => data.json())
|
|
45
|
-
.then((json) => {
|
|
46
|
-
setAnimationData(json);
|
|
47
|
-
continueRender(handle);
|
|
48
|
-
})
|
|
49
|
-
.catch((err) => {
|
|
50
|
-
cancelRender(err);
|
|
51
|
-
});
|
|
52
|
-
}, [handle]);
|
|
53
|
-
|
|
54
|
-
if (!animationData) {
|
|
55
|
-
return null;
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
return <Lottie animationData={animationData} />;
|
|
59
|
-
};
|
|
60
|
-
```
|
|
61
|
-
|
|
62
|
-
## Styling and animating
|
|
63
|
-
|
|
64
|
-
Lottie supports the `style` prop to allow styles and animations:
|
|
65
|
-
|
|
66
|
-
```tsx
|
|
67
|
-
return (
|
|
68
|
-
<Lottie
|
|
69
|
-
animationData={animationData}
|
|
70
|
-
style={{ width: 400, height: 400 }}
|
|
71
|
-
/>
|
|
72
|
-
);
|
|
73
|
-
```
|
|
1
|
+
---
|
|
2
|
+
name: lottie
|
|
3
|
+
description: Embedding Lottie animations in Remotion.
|
|
4
|
+
metadata:
|
|
5
|
+
category: Animation
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
# Using Lottie Animations in Remotion
|
|
9
|
+
|
|
10
|
+
## Prerequisites
|
|
11
|
+
|
|
12
|
+
First, the @remotion/lottie package needs to be installed.
|
|
13
|
+
If it is not, use the following command:
|
|
14
|
+
|
|
15
|
+
```bash
|
|
16
|
+
npx remotion add @remotion/lottie # If project uses npm
|
|
17
|
+
bunx remotion add @remotion/lottie # If project uses bun
|
|
18
|
+
yarn remotion add @remotion/lottie # If project uses yarn
|
|
19
|
+
pnpm exec remotion add @remotion/lottie # If project uses pnpm
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
## Displaying a Lottie file
|
|
23
|
+
|
|
24
|
+
To import a Lottie animation:
|
|
25
|
+
|
|
26
|
+
- Fetch the Lottie asset
|
|
27
|
+
- Wrap the loading process in `delayRender()` and `continueRender()`
|
|
28
|
+
- Save the animation data in a state
|
|
29
|
+
- Render the Lottie animation using the `Lottie` component from the `@remotion/lottie` package
|
|
30
|
+
|
|
31
|
+
```tsx
|
|
32
|
+
import { Lottie, LottieAnimationData } from "@remotion/lottie";
|
|
33
|
+
import { useEffect, useState } from "react";
|
|
34
|
+
import { cancelRender, continueRender, delayRender } from "remotion";
|
|
35
|
+
|
|
36
|
+
export const MyAnimation = () => {
|
|
37
|
+
const [handle] = useState(() => delayRender("Loading Lottie animation"));
|
|
38
|
+
|
|
39
|
+
const [animationData, setAnimationData] =
|
|
40
|
+
useState<LottieAnimationData | null>(null);
|
|
41
|
+
|
|
42
|
+
useEffect(() => {
|
|
43
|
+
fetch("https://assets4.lottiefiles.com/packages/lf20_zyquagfl.json")
|
|
44
|
+
.then((data) => data.json())
|
|
45
|
+
.then((json) => {
|
|
46
|
+
setAnimationData(json);
|
|
47
|
+
continueRender(handle);
|
|
48
|
+
})
|
|
49
|
+
.catch((err) => {
|
|
50
|
+
cancelRender(err);
|
|
51
|
+
});
|
|
52
|
+
}, [handle]);
|
|
53
|
+
|
|
54
|
+
if (!animationData) {
|
|
55
|
+
return null;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
return <Lottie animationData={animationData} />;
|
|
59
|
+
};
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
## Styling and animating
|
|
63
|
+
|
|
64
|
+
Lottie supports the `style` prop to allow styles and animations:
|
|
65
|
+
|
|
66
|
+
```tsx
|
|
67
|
+
return (
|
|
68
|
+
<Lottie
|
|
69
|
+
animationData={animationData}
|
|
70
|
+
style={{ width: 400, height: 400 }}
|
|
71
|
+
/>
|
|
72
|
+
);
|
|
73
|
+
```
|
|
@@ -1,38 +1,38 @@
|
|
|
1
|
-
---
|
|
2
|
-
name: measuring-dom-nodes
|
|
3
|
-
description: Measuring DOM element dimensions in Remotion
|
|
4
|
-
metadata:
|
|
5
|
-
tags: measure, layout, dimensions, getBoundingClientRect, scale
|
|
6
|
-
---
|
|
7
|
-
|
|
8
|
-
# Measuring DOM nodes in Remotion
|
|
9
|
-
|
|
10
|
-
Remotion applies a `scale()` transform to the video container, which affects values from `getBoundingClientRect()`. Use `useCurrentScale()` to get correct measurements.
|
|
11
|
-
|
|
12
|
-
## Measuring element dimensions
|
|
13
|
-
|
|
14
|
-
```tsx
|
|
15
|
-
import { useCurrentScale } from "remotion";
|
|
16
|
-
import { useRef, useEffect, useState } from "react";
|
|
17
|
-
|
|
18
|
-
export const MyComponent = () => {
|
|
19
|
-
const ref = useRef<HTMLDivElement>(null);
|
|
20
|
-
const scale = useCurrentScale();
|
|
21
|
-
const [dimensions, setDimensions] = useState({ width: 0, height: 0 });
|
|
22
|
-
|
|
23
|
-
useEffect(() => {
|
|
24
|
-
if (!ref.current) return;
|
|
25
|
-
const rect = ref.current.getBoundingClientRect();
|
|
26
|
-
setDimensions({
|
|
27
|
-
width: rect.width / scale,
|
|
28
|
-
height: rect.height / scale,
|
|
29
|
-
});
|
|
30
|
-
}, [scale]);
|
|
31
|
-
|
|
32
|
-
return (
|
|
33
|
-
<div ref={ref}>
|
|
34
|
-
Content to measure
|
|
35
|
-
</div>
|
|
36
|
-
);
|
|
37
|
-
};
|
|
38
|
-
```
|
|
1
|
+
---
|
|
2
|
+
name: measuring-dom-nodes
|
|
3
|
+
description: Measuring DOM element dimensions in Remotion
|
|
4
|
+
metadata:
|
|
5
|
+
tags: measure, layout, dimensions, getBoundingClientRect, scale
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
# Measuring DOM nodes in Remotion
|
|
9
|
+
|
|
10
|
+
Remotion applies a `scale()` transform to the video container, which affects values from `getBoundingClientRect()`. Use `useCurrentScale()` to get correct measurements.
|
|
11
|
+
|
|
12
|
+
## Measuring element dimensions
|
|
13
|
+
|
|
14
|
+
```tsx
|
|
15
|
+
import { useCurrentScale } from "remotion";
|
|
16
|
+
import { useRef, useEffect, useState } from "react";
|
|
17
|
+
|
|
18
|
+
export const MyComponent = () => {
|
|
19
|
+
const ref = useRef<HTMLDivElement>(null);
|
|
20
|
+
const scale = useCurrentScale();
|
|
21
|
+
const [dimensions, setDimensions] = useState({ width: 0, height: 0 });
|
|
22
|
+
|
|
23
|
+
useEffect(() => {
|
|
24
|
+
if (!ref.current) return;
|
|
25
|
+
const rect = ref.current.getBoundingClientRect();
|
|
26
|
+
setDimensions({
|
|
27
|
+
width: rect.width / scale,
|
|
28
|
+
height: rect.height / scale,
|
|
29
|
+
});
|
|
30
|
+
}, [scale]);
|
|
31
|
+
|
|
32
|
+
return (
|
|
33
|
+
<div ref={ref}>
|
|
34
|
+
Content to measure
|
|
35
|
+
</div>
|
|
36
|
+
);
|
|
37
|
+
};
|
|
38
|
+
```
|
|
@@ -1,146 +1,146 @@
|
|
|
1
|
-
---
|
|
2
|
-
name: measuring-text
|
|
3
|
-
description: Measuring text dimensions, fitting text to containers, and checking overflow
|
|
4
|
-
metadata:
|
|
5
|
-
tags: measure, text, layout, dimensions, fitText, fillTextBox
|
|
6
|
-
---
|
|
7
|
-
|
|
8
|
-
# Measuring text in Remotion
|
|
9
|
-
|
|
10
|
-
## Prerequisites
|
|
11
|
-
|
|
12
|
-
Install @remotion/layout-utils if it is not already installed:
|
|
13
|
-
|
|
14
|
-
```bash
|
|
15
|
-
npx remotion add @remotion/layout-utils
|
|
16
|
-
```
|
|
17
|
-
|
|
18
|
-
## Measuring text dimensions
|
|
19
|
-
|
|
20
|
-
Use `measureText()` to calculate the width and height of text:
|
|
21
|
-
|
|
22
|
-
```tsx
|
|
23
|
-
import { measureText } from "@remotion/layout-utils";
|
|
24
|
-
|
|
25
|
-
const { width, height } = measureText({
|
|
26
|
-
text: "Hello World",
|
|
27
|
-
fontFamily: "Arial",
|
|
28
|
-
fontSize: 32,
|
|
29
|
-
fontWeight: "bold",
|
|
30
|
-
});
|
|
31
|
-
```
|
|
32
|
-
|
|
33
|
-
Results are cached - duplicate calls return the cached result.
|
|
34
|
-
|
|
35
|
-
## Fitting text to a width
|
|
36
|
-
|
|
37
|
-
Use `fitText()` to find the optimal font size for a container:
|
|
38
|
-
|
|
39
|
-
```tsx
|
|
40
|
-
import { fitText } from "@remotion/layout-utils";
|
|
41
|
-
|
|
42
|
-
const { fontSize } = fitText({
|
|
43
|
-
text: "Hello World",
|
|
44
|
-
withinWidth: 600,
|
|
45
|
-
fontFamily: "Inter",
|
|
46
|
-
fontWeight: "bold",
|
|
47
|
-
});
|
|
48
|
-
|
|
49
|
-
return (
|
|
50
|
-
<div
|
|
51
|
-
style={{
|
|
52
|
-
fontSize: Math.min(fontSize, 80), // Cap at 80px
|
|
53
|
-
fontFamily: "Inter",
|
|
54
|
-
fontWeight: "bold",
|
|
55
|
-
}}
|
|
56
|
-
>
|
|
57
|
-
Hello World
|
|
58
|
-
</div>
|
|
59
|
-
);
|
|
60
|
-
```
|
|
61
|
-
|
|
62
|
-
## Checking text overflow
|
|
63
|
-
|
|
64
|
-
Use `fillTextBox()` to check if text exceeds a box:
|
|
65
|
-
|
|
66
|
-
```tsx
|
|
67
|
-
import { fillTextBox } from "@remotion/layout-utils";
|
|
68
|
-
|
|
69
|
-
const box = fillTextBox({ maxBoxWidth: 400, maxLines: 3 });
|
|
70
|
-
|
|
71
|
-
const words = ["Hello", "World", "This", "is", "a", "test"];
|
|
72
|
-
for (const word of words) {
|
|
73
|
-
const { exceedsBox } = box.add({
|
|
74
|
-
text: word + " ",
|
|
75
|
-
fontFamily: "Arial",
|
|
76
|
-
fontSize: 24,
|
|
77
|
-
});
|
|
78
|
-
if (exceedsBox) {
|
|
79
|
-
// Text would overflow, handle accordingly
|
|
80
|
-
break;
|
|
81
|
-
}
|
|
82
|
-
}
|
|
83
|
-
```
|
|
84
|
-
|
|
85
|
-
## Best practices
|
|
86
|
-
|
|
87
|
-
**Load fonts first:** Only call measurement functions after fonts are loaded.
|
|
88
|
-
|
|
89
|
-
```tsx
|
|
90
|
-
import { loadFont } from "@remotion/google-fonts/Inter";
|
|
91
|
-
|
|
92
|
-
const { fontFamily, waitUntilDone } = loadFont("normal", {
|
|
93
|
-
weights: ["400"],
|
|
94
|
-
subsets: ["latin"],
|
|
95
|
-
});
|
|
96
|
-
|
|
97
|
-
waitUntilDone().then(() => {
|
|
98
|
-
// Now safe to measure
|
|
99
|
-
const { width } = measureText({
|
|
100
|
-
text: "Hello",
|
|
101
|
-
fontFamily,
|
|
102
|
-
fontSize: 32,
|
|
103
|
-
});
|
|
104
|
-
});
|
|
105
|
-
```
|
|
106
|
-
|
|
107
|
-
**Use validateFontIsLoaded:** Catch font loading issues early:
|
|
108
|
-
|
|
109
|
-
```tsx
|
|
110
|
-
measureText({
|
|
111
|
-
text: "Hello",
|
|
112
|
-
fontFamily: "MyCustomFont",
|
|
113
|
-
fontSize: 32,
|
|
114
|
-
validateFontIsLoaded: true, // Throws if font not loaded
|
|
115
|
-
});
|
|
116
|
-
```
|
|
117
|
-
|
|
118
|
-
**Match font properties:** Use the same properties for measurement and rendering:
|
|
119
|
-
|
|
120
|
-
```tsx
|
|
121
|
-
const fontStyle = {
|
|
122
|
-
fontFamily: "Inter",
|
|
123
|
-
fontSize: 32,
|
|
124
|
-
fontWeight: "bold" as const,
|
|
125
|
-
letterSpacing: "0.5px",
|
|
126
|
-
};
|
|
127
|
-
|
|
128
|
-
const { width } = measureText({
|
|
129
|
-
text: "Hello",
|
|
130
|
-
...fontStyle,
|
|
131
|
-
});
|
|
132
|
-
|
|
133
|
-
return (
|
|
134
|
-
<div style={fontStyle}>
|
|
135
|
-
Hello
|
|
136
|
-
</div>
|
|
137
|
-
);
|
|
138
|
-
```
|
|
139
|
-
|
|
140
|
-
**Avoid padding and border:** Use `outline` instead of `border` to prevent layout differences:
|
|
141
|
-
|
|
142
|
-
```tsx
|
|
143
|
-
<div style={{ outline: "2px solid red" }}>
|
|
144
|
-
Text
|
|
145
|
-
</div>
|
|
146
|
-
```
|
|
1
|
+
---
|
|
2
|
+
name: measuring-text
|
|
3
|
+
description: Measuring text dimensions, fitting text to containers, and checking overflow
|
|
4
|
+
metadata:
|
|
5
|
+
tags: measure, text, layout, dimensions, fitText, fillTextBox
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
# Measuring text in Remotion
|
|
9
|
+
|
|
10
|
+
## Prerequisites
|
|
11
|
+
|
|
12
|
+
Install @remotion/layout-utils if it is not already installed:
|
|
13
|
+
|
|
14
|
+
```bash
|
|
15
|
+
npx remotion add @remotion/layout-utils
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
## Measuring text dimensions
|
|
19
|
+
|
|
20
|
+
Use `measureText()` to calculate the width and height of text:
|
|
21
|
+
|
|
22
|
+
```tsx
|
|
23
|
+
import { measureText } from "@remotion/layout-utils";
|
|
24
|
+
|
|
25
|
+
const { width, height } = measureText({
|
|
26
|
+
text: "Hello World",
|
|
27
|
+
fontFamily: "Arial",
|
|
28
|
+
fontSize: 32,
|
|
29
|
+
fontWeight: "bold",
|
|
30
|
+
});
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
Results are cached - duplicate calls return the cached result.
|
|
34
|
+
|
|
35
|
+
## Fitting text to a width
|
|
36
|
+
|
|
37
|
+
Use `fitText()` to find the optimal font size for a container:
|
|
38
|
+
|
|
39
|
+
```tsx
|
|
40
|
+
import { fitText } from "@remotion/layout-utils";
|
|
41
|
+
|
|
42
|
+
const { fontSize } = fitText({
|
|
43
|
+
text: "Hello World",
|
|
44
|
+
withinWidth: 600,
|
|
45
|
+
fontFamily: "Inter",
|
|
46
|
+
fontWeight: "bold",
|
|
47
|
+
});
|
|
48
|
+
|
|
49
|
+
return (
|
|
50
|
+
<div
|
|
51
|
+
style={{
|
|
52
|
+
fontSize: Math.min(fontSize, 80), // Cap at 80px
|
|
53
|
+
fontFamily: "Inter",
|
|
54
|
+
fontWeight: "bold",
|
|
55
|
+
}}
|
|
56
|
+
>
|
|
57
|
+
Hello World
|
|
58
|
+
</div>
|
|
59
|
+
);
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
## Checking text overflow
|
|
63
|
+
|
|
64
|
+
Use `fillTextBox()` to check if text exceeds a box:
|
|
65
|
+
|
|
66
|
+
```tsx
|
|
67
|
+
import { fillTextBox } from "@remotion/layout-utils";
|
|
68
|
+
|
|
69
|
+
const box = fillTextBox({ maxBoxWidth: 400, maxLines: 3 });
|
|
70
|
+
|
|
71
|
+
const words = ["Hello", "World", "This", "is", "a", "test"];
|
|
72
|
+
for (const word of words) {
|
|
73
|
+
const { exceedsBox } = box.add({
|
|
74
|
+
text: word + " ",
|
|
75
|
+
fontFamily: "Arial",
|
|
76
|
+
fontSize: 24,
|
|
77
|
+
});
|
|
78
|
+
if (exceedsBox) {
|
|
79
|
+
// Text would overflow, handle accordingly
|
|
80
|
+
break;
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
## Best practices
|
|
86
|
+
|
|
87
|
+
**Load fonts first:** Only call measurement functions after fonts are loaded.
|
|
88
|
+
|
|
89
|
+
```tsx
|
|
90
|
+
import { loadFont } from "@remotion/google-fonts/Inter";
|
|
91
|
+
|
|
92
|
+
const { fontFamily, waitUntilDone } = loadFont("normal", {
|
|
93
|
+
weights: ["400"],
|
|
94
|
+
subsets: ["latin"],
|
|
95
|
+
});
|
|
96
|
+
|
|
97
|
+
waitUntilDone().then(() => {
|
|
98
|
+
// Now safe to measure
|
|
99
|
+
const { width } = measureText({
|
|
100
|
+
text: "Hello",
|
|
101
|
+
fontFamily,
|
|
102
|
+
fontSize: 32,
|
|
103
|
+
});
|
|
104
|
+
});
|
|
105
|
+
```
|
|
106
|
+
|
|
107
|
+
**Use validateFontIsLoaded:** Catch font loading issues early:
|
|
108
|
+
|
|
109
|
+
```tsx
|
|
110
|
+
measureText({
|
|
111
|
+
text: "Hello",
|
|
112
|
+
fontFamily: "MyCustomFont",
|
|
113
|
+
fontSize: 32,
|
|
114
|
+
validateFontIsLoaded: true, // Throws if font not loaded
|
|
115
|
+
});
|
|
116
|
+
```
|
|
117
|
+
|
|
118
|
+
**Match font properties:** Use the same properties for measurement and rendering:
|
|
119
|
+
|
|
120
|
+
```tsx
|
|
121
|
+
const fontStyle = {
|
|
122
|
+
fontFamily: "Inter",
|
|
123
|
+
fontSize: 32,
|
|
124
|
+
fontWeight: "bold" as const,
|
|
125
|
+
letterSpacing: "0.5px",
|
|
126
|
+
};
|
|
127
|
+
|
|
128
|
+
const { width } = measureText({
|
|
129
|
+
text: "Hello",
|
|
130
|
+
...fontStyle,
|
|
131
|
+
});
|
|
132
|
+
|
|
133
|
+
return (
|
|
134
|
+
<div style={fontStyle}>
|
|
135
|
+
Hello
|
|
136
|
+
</div>
|
|
137
|
+
);
|
|
138
|
+
```
|
|
139
|
+
|
|
140
|
+
**Avoid padding and border:** Use `outline` instead of `border` to prevent layout differences:
|
|
141
|
+
|
|
142
|
+
```tsx
|
|
143
|
+
<div style={{ outline: "2px solid red" }}>
|
|
144
|
+
Text
|
|
145
|
+
</div>
|
|
146
|
+
```
|