Skip to content

🎥 Make videos programmatically with React

add 30 JSdoc comments

Jonny Burger2544a64e14b2
diff --git a/packages/ai-improvements/improve-docs.ts b/packages/ai-improvements/improve-docs.ts
index 8228a58641..a9fb0a8499 100644
--- a/packages/ai-improvements/improve-docs.ts
+++ b/packages/ai-improvements/improve-docs.ts
@@ -1,7 +1,8 @@
import path from "path";
-import { articles } from "../docs/src/data/articles";
import { OpenAI } from "openai";
import { getApis } from "./map-over-api";
+import { findMistakes } from "./tasks/find-mistakes";
+import { generateJSDocTask } from "./tasks/generate-jsdoc";
const openai = new OpenAI({
apiKey: process.env.OPEN_AI_API_KEY,
@@ -9,6 +10,8 @@ const openai = new OpenAI({
const apis = await getApis();
+const task = "generate-jsdoc";
+
for (const api of apis) {
const contents = await Bun.file(api.filePath).text();
if (!api.sourceCodePath) {
@@ -27,37 +30,22 @@ for (const api of apis) {
const sourceContents = await Bun.file(file).text();
console.log(`Article ${api.title} contains source code`);
- const stream = await openai.chat.completions.create({
- model: "gpt-4-turbo",
- messages: [
- {
- role: "system",
- content: [
- "You are going to be given an API and an API documentation.",
- "respond if you think the API documentation is missing parameters the user can pass or the return value is not right.",
- "Also point out typos.",
- "Do only point out obvious mistakes.",
- "Sometimes props are documented like ### `delayRenderRetries`<AvailableFrom v='4.0.140' />, which is fine",
- "Consider that the documentation may contain backticks and html tags, which are not mistakes.",
- "Point out if the markdown is not formatted correctly.",
- "Rewrite paragraphs and sentences that we need to correct.",
- "Otherwise, just say OK.",
- ].join("\n"),
- },
- {
- role: "user",
- content: "This is the source code for the API:\n" + sourceContents,
- },
- {
- role: "user",
- content: "This is the markdown of the documentation:\n" + contents,
- },
- ],
- stream: true,
- });
- for await (const chunk of stream) {
- process.stdout.write(chunk.choices[0]?.delta?.content || "");
- }
+ const reply =
+ task === "generate-jsdoc"
+ ? await generateJSDocTask({
+ contents,
+ link: api.link,
+ openai,
+ sourceContents,
+ })
+ : await findMistakes({
+ sourceContents,
+ openai,
+ contents,
+ });
+
await Bun.write(flag, "txt");
- process.exit(0);
+ if (reply !== "OK") {
+ process.exit(0);
+ }
}
diff --git a/packages/ai-improvements/map-over-api.ts b/packages/ai-improvements/map-over-api.ts
index b3ef2784bc..0571094e06 100644
--- a/packages/ai-improvements/map-over-api.ts
+++ b/packages/ai-improvements/map-over-api.ts
@@ -29,6 +29,7 @@ type Api = {
sourceCodePath: string | null;
id: string;
title: string;
+ link: string;
};
const arr: Api[] = [];
@@ -44,6 +45,7 @@ export const getApis = async () => {
sourceCodePath: sourceCodeLink,
id: article.id,
title: article.title,
+ link: `https://remotion.dev/docs/${article.id}`,
});
}
diff --git a/packages/ai-improvements/tasks/find-mistakes.ts b/packages/ai-improvements/tasks/find-mistakes.ts
new file mode 100644
index 0000000000..fb5bffa35d
--- /dev/null
+++ b/packages/ai-improvements/tasks/find-mistakes.ts
@@ -0,0 +1,47 @@
+import { OpenAI } from "openai";
+
+export const findMistakes = async ({
+ sourceContents,
+ openai,
+ contents,
+}: {
+ sourceContents: string;
+ openai: OpenAI;
+ contents: string;
+}) => {
+ const stream = await openai.chat.completions.create({
+ model: "gpt-4-turbo",
+ messages: [
+ {
+ role: "system",
+ content: [
+ "You are going to be given an API and an API documentation.",
+ "respond if you think the API documentation is missing parameters the user can pass or the return value is not right.",
+ "Also point out typos.",
+ "Do only point out obvious mistakes.",
+ "Sometimes props are documented like ### `delayRenderRetries`<AvailableFrom v='4.0.140' />, which is fine",
+ "Consider that the documentation may contain backticks and html tags, which are not mistakes.",
+ "Point out if the markdown is not formatted correctly.",
+ "Rewrite paragraphs and sentences that we need to correct.",
+ "Otherwise, just say OK.",
+ ].join("\n"),
+ },
+ {
+ role: "user",
+ content: "This is the source code for the API:\n" + sourceContents,
+ },
+ {
+ role: "user",
+ content: "This is the markdown of the documentation:\n" + contents,
+ },
+ ],
+ stream: true,
+ });
+ let reply = "";
+ for await (const chunk of stream) {
+ reply += chunk.choices[0]?.delta?.content || "";
+ process.stdout.write(chunk.choices[0]?.delta?.content || "");
+ }
+
+ return reply;
+};
diff --git a/packages/ai-improvements/tasks/generate-jsdoc.ts b/packages/ai-improvements/tasks/generate-jsdoc.ts
new file mode 100644
index 0000000000..427d4a21bc
--- /dev/null
+++ b/packages/ai-improvements/tasks/generate-jsdoc.ts
@@ -0,0 +1,59 @@
+import { OpenAI } from "openai";
+
+export const generateJSDocTask = async ({
+ sourceContents,
+ openai,
+ contents,
+ link,
+}: {
+ sourceContents: string;
+ openai: OpenAI;
+ contents: string;
+ link: string;
+}) => {
+ const stream = await openai.chat.completions.create({
+ model: "gpt-4-turbo",
+ messages: [
+ {
+ role: "system",
+ content: [
+ "You are going to be given an API source code and an API documentation, and a URL to use.",
+ "Check if the function already has a JSDoc comment.",
+ "If it does, respond only with 'OK'.",
+ "If not, write a JSDoc comment for the function. Only write the JSDoc comment, don't reply anything else.",
+ "Put the URL as the documentation.",
+ "This is the right format for a JSDoc comment:\n",
+ `
+/**
+ * @description Triggers a render on a lambda given a composition and a lambda function.
+ * @see [Documentation](https://remotion.dev/docs/lambda/rendermediaonlambda)
+ * @param params.functionName The name of the Lambda function that should be used
+ * @param params.serveUrl The URL of the deployed project
+ * @returns {Promise<RenderMediaOnLambdaOutput>} See documentation for detailed structure
+ */
+ `,
+ ].join("\n"),
+ },
+ {
+ role: "system",
+ content: "This is the url to use:\n" + link,
+ },
+ {
+ role: "user",
+ content: "This is the source code for the API:\n" + sourceContents,
+ },
+ {
+ role: "user",
+ content: "This is the markdown of the documentation:\n" + contents,
+ },
+ ],
+ stream: true,
+ });
+ let reply = "";
+ for await (const chunk of stream) {
+ reply += chunk.choices[0]?.delta?.content || "";
+ process.stdout.write(chunk.choices[0]?.delta?.content || "");
+ }
+
+ return reply;
+};
diff --git a/packages/core/ensure-correct-version.ts b/packages/core/ensure-correct-version.ts
index 34279f4685..3b43ba4b5d 100644
--- a/packages/core/ensure-correct-version.ts
+++ b/packages/core/ensure-correct-version.ts
@@ -7,6 +7,12 @@ const {version} = packageJson;
const src =
`
// Automatically generated on publish
+
+/**
+ * @description Provides the current version number of the Remotion library.
+ * @see [Documentation](https://remotion.dev/docs/version)
+ * @returns {string} The current version of the remotion package
+ */
export const VERSION = '${version}';
`.trim() + '\n';
diff --git a/packages/core/src/version.ts b/packages/core/src/version.ts
index b3f1f8a025..2c92da4b01 100644
--- a/packages/core/src/version.ts
+++ b/packages/core/src/version.ts
@@ -1,2 +1,7 @@
// Automatically generated on publish
+/**
+ * @description Provides the current version number of the Remotion library.
+ * @see [Documentation](https://remotion.dev/docs/version)
+ * @returns {string} The current version of the library
+ */
export const VERSION = '4.0.143';
diff --git a/packages/docs/docs/paths/warp-path.md b/packages/docs/docs/paths/warp-path.md
index 8840633d43..2984dda890 100644
--- a/packages/docs/docs/paths/warp-path.md
+++ b/packages/docs/docs/paths/warp-path.md
@@ -87,4 +87,4 @@ This function is based on the [WarpJS](https://benjamminf.github.io/warpjs/) lib
- [`@remotion/paths`](/docs/paths)
- [Example repo](https://github.com/remotion-dev/text-warping)
-- [Source code for this function](https://github.com/remotion-dev/remotion/blob/main/packages/paths/src/warp-path.ts)
+- [Source code for this function](https://github.com/remotion-dev/remotion/blob/main/packages/paths/src/warp-path/index.ts)
diff --git a/packages/docs/docs/renderer/get-can-extract-frames-fast.md b/packages/docs/docs/renderer/get-can-extract-frames-fast.md
index cee2b0322a..0ce054fd17 100644
--- a/packages/docs/docs/renderer/get-can-extract-frames-fast.md
+++ b/packages/docs/docs/renderer/get-can-extract-frames-fast.md
@@ -78,7 +78,3 @@ Returns a promise which resolves to an object with the following parameters:
- `canExtractFramesFast`: _boolean_ Whether it will be fast to extract a frame from a video.
- `shouldReencode`: _boolean_ Whether the video can be re-encoded to make the render faster.
-
-## See also
-
-- [Source code for this function](https://github.com/remotion-dev/remotion/blob/main/packages/renderer/src/can-extract-frames-fast.ts)
diff --git a/packages/lambda/src/api/iam-validation/suggested-policy.ts b/packages/lambda/src/api/iam-validation/suggested-policy.ts
index 435b188a1f..8922454493 100644
--- a/packages/lambda/src/api/iam-validation/suggested-policy.ts
+++ b/packages/lambda/src/api/iam-validation/suggested-policy.ts
@@ -30,8 +30,9 @@ const suggestedRolePolicy = {
};
/**
- * @description Returns an inline JSON policy to be assigned to the AWS user whose credentials are being used for excuting CLI commands or calling Node.JS functions.
- * @link https://remotion.dev/docs/lambda/getuserpolicy
+ * @description Returns an inline JSON policy to be assigned to the AWS user whose credentials are being used for executing CLI commands or calling Node.JS functions.
+ * @see [Documentation](https://remotion.dev/docs/lambda/getuserpolicy)
+ * @returns {string} A JSON string representation of the user policy.
*/
export const getUserPolicy = () => JSON.stringify(suggestedPolicy, null, 2);
@@ -40,6 +41,7 @@ export const ROLE_NAME = 'remotion-lambda-role';
/**
* @description Returns an inline JSON policy to be assigned to the 'remotion-lambda-role' role that needs to be created in your AWS account.
- * @link https://remotion.dev/docs/lambda/getrolepolicy
+ * @see [Documentation](https://remotion.dev/docs/lambda/getrolepolicy)
+ * @returns {object} The policy object which includes the version and statements specific to AWS permissions for the lambda function
*/
export const getRolePolicy = () => JSON.stringify(suggestedRolePolicy, null, 2);
diff --git a/packages/layout-utils/src/layouts/fit-text.ts b/packages/layout-utils/src/layouts/fit-text.ts
index df10a8fd62..06c0e9c1da 100644
--- a/packages/layout-utils/src/layouts/fit-text.ts
+++ b/packages/layout-utils/src/layouts/fit-text.ts
@@ -5,7 +5,21 @@ import type {
import {measureText} from '../layouts/measure-text';
const sampleSize = 100;
-
+/**
+ * @description Calculates the font size needed to fit text into a specified width container.
+ * @see [Documentation](https://remotion.dev/docs/layout-utils/fit-text)
+ * @param {Object} params - The parameters containing details to fit text.
+ * @param {string} params.text - The text content to fit.
+ * @param {number} params.withinWidth - The container width to fit the text into.
+ * @param {string} params.fontFamily - The font family to apply to the text.
+ * @param {string|number} [params.fontWeight] - The font weight to apply (optional).
+ * @param {string} [params.letterSpacing] - The spacing between letters (optional).
+ * @param {string} [params.fontVariantNumeric] - The numeric font variant to apply (optional).
+ * @param {boolean} [params.validateFontIsLoaded] - Validate if the font is loaded before rendering text (optional).
+ * @param {TextTransform} [params.textTransform] - Text transformation to apply (uppercase, lowercase) (optional).
+ * @param {ModifyableCSSProperties} [params.additionalStyles] - Additional CSS properties affecting text layout (optional).
+ * @returns {Object} An object containing the computed `fontSize` to use for the specified width.
+ */
export const fitText = ({
text,
withinWidth,
diff --git a/packages/layout-utils/src/layouts/measure-text.ts b/packages/layout-utils/src/layouts/measure-text.ts
index 77e8538a51..05f1445e1f 100644
--- a/packages/layout-utils/src/layouts/measure-text.ts
+++ b/packages/layout-utils/src/layouts/measure-text.ts
@@ -111,6 +111,13 @@ const takeMeasurement = ({
};
};
+/**
+ * Calculates the width and height of specified text to be used for layout calculations.
+ * Only works in the browser, not in Node.js or Bun.
+ * @see [Documentation](https://remotion.dev/docs/layout-utils/measure-text)
+ * @param {Word} wordOptions - The text options to measure, including the text itself, font properties, and additional styles.
+ * @returns {Dimensions} The dimensions object containing the measured width and height of the text.
+ */
export const measureText = ({
text,
fontFamily,
diff --git a/packages/paths/src/get-instruction-index-at-length.ts b/packages/paths/src/get-instruction-index-at-length.ts
index 26ee8642c7..c66ebcee9e 100644
--- a/packages/paths/src/get-instruction-index-at-length.ts
+++ b/packages/paths/src/get-instruction-index-at-length.ts
@@ -30,6 +30,14 @@ export const getInstructionIndexAtLengthFromConstructed = (
};
};
+/**
+ * @description Gets the index of the instruction and the part length into the instruction at a specified length along an SVG path.
+ * @see [Documentation](https://remotion.dev/docs/paths/get-instruction-index-at-length)
+ * @param path The SVG path data as a string.
+ * @param length The length along the path at which to find the instruction index and the part length into the instruction.
+ * @returns {InstructionAtLength} Object containing the index of the instruction and the part length into the instruction at the given length.
+ * @throws {Error} If the given length is less than 0 or greater than the total length of the path, or if the path is invalid.
+ */
export const getInstructionIndexAtLength = (
path: string,
length: number,
diff --git a/packages/paths/src/normalize-path.ts b/packages/paths/src/normalize-path.ts
index 94bfeb2896..7a91667867 100644
--- a/packages/paths/src/normalize-path.ts
+++ b/packages/paths/src/normalize-path.ts
@@ -1,6 +1,7 @@
import type {AbsoluteInstruction, Instruction} from './helpers/types';
import {parsePath} from './parse-path';
import {serializeInstructions} from './serialize-instructions';
+
export const normalizeInstructions = (
instructions: Instruction[],
): AbsoluteInstruction[] => {
@@ -173,8 +174,9 @@ export const normalizeInstructions = (
/**
* @description Removes all relative coordinates from an SVG path and converts them into absolute coordinates.
- * @param {string} path A valid SVG path
* @see [Documentation](https://remotion.dev/docs/paths/normalize-path)
+ * @param {string} path A valid SVG path
+ * @returns {string} A string representation of the SVG path with absolute coordinates.
*/
export const normalizePath = (path: string): string => {
const instructions = parsePath(path);
diff --git a/packages/player/src/Player.tsx b/packages/player/src/Player.tsx
index 7ee417631b..1db63a5b93 100644
--- a/packages/player/src/Player.tsx
+++ b/packages/player/src/Player.tsx
@@ -400,7 +400,10 @@ const forward = forwardRef as <T, P = {}>(
) => (props: P & React.RefAttributes<T>) => React.ReactElement | null;
/**
- * @description A component which can be rendered in a regular React App (for example: Vite, Next.js) to display a Remotion video.
- * @see [Documentation](https://www.remotion.dev/docs/player/player)
+ * @description Creates and renders a customizable video player with various interactive controls for a React application.
+ * @see [Documentation](https://remotion.dev/docs/player/api)
+ * @param {PlayerProps<Schema, Props>} props The properties for configuring the player, including video specifics and UI controls.
+ * @param {MutableRefObject<PlayerRef>} ref Reference to the player for controlling playback, volume, and other aspects.
+ * @returns {JSX.Element} The rendered video player component.
*/
export const Player = forward(PlayerFn);
diff --git a/packages/renderer/src/ensure-browser.ts b/packages/renderer/src/ensure-browser.ts
index bde470ecd2..013718831b 100644
--- a/packages/renderer/src/ensure-browser.ts
+++ b/packages/renderer/src/ensure-browser.ts
@@ -77,6 +77,12 @@ const getBrowserStatus = (
return {type: 'no-browser'};
};
+/**
+ * Ensures a browser is locally installed so a Remotion render can be executed. This function manages the browser's download or validates existing browser paths.
+ * @see [Documentation](https://remotion.dev/docs/renderer/ensure-browser)
+ * @param {EnsureBrowserOptions} [options] Configuration options which may include a `browserExecutable` path, `logLevel` settings, and `onBrowserDownload` function to manage download specifics and progression.
+ * @returns {Promise<void>} A promise that resolves when the browser is prepared with no explicit return value.
+ */
export const ensureBrowser = (options?: EnsureBrowserOptions) => {
const indent = false;
const logLevel = options?.logLevel ?? 'info';
diff --git a/packages/renderer/src/extract-audio.ts b/packages/renderer/src/extract-audio.ts
index f527707e33..f1eacd4fb9 100644
--- a/packages/renderer/src/extract-audio.ts
+++ b/packages/renderer/src/extract-audio.ts
@@ -1,6 +1,15 @@
import {startLongRunningCompositor} from './compositor/compositor';
import type {LogLevel} from './log-level';
+/**
+ * @description Extracts the audio from a video source and saves it at the specified output path without changing the audio format.
+ * @see [Documentation](https://remotion.dev/docs/renderer/extract-audio)
+ * @param options.videoSource The path to the video source from which the audio will be extracted.
+ * @param options.audioOutput The path where the extracted audio will be saved. Must use the correct file extension which matches the audio codec.
+ * @param options.logLevel The level of logging desired (optional).
+ * @param options.binariesDirectory The directory for binary dependencies (optional).
+ * @returns {Promise<void>} Resolves once the audio extraction is complete.
+ */
export const extractAudio = async (options: {
videoSource: string;
audioOutput: string;
diff --git a/packages/renderer/src/get-compositions.ts b/packages/renderer/src/get-compositions.ts
index 6ecd59995b..2251144d55 100644
--- a/packages/renderer/src/get-compositions.ts
+++ b/packages/renderer/src/get-compositions.ts
@@ -247,7 +247,10 @@ export const internalGetCompositions = wrapWithErrorHandling(
/**
* @description Gets the compositions defined in a Remotion project based on a Webpack bundle.
- * @see [Documentation](https://www.remotion.dev/docs/renderer/get-compositions)
+ * @see [Documentation](https://remotion.dev/docs/get-compositions)
+ * @param serveUrlOrWebpackUrl URL pointing to the Remotion Bundle.
+ * @param {GetCompositionsOptions} [config] Optional configurations for getting composition details.
+ * @returns {Promise<VideoConfig[]>} Returns a promise that resolves to an array of available compositions.
*/
export const getCompositions = (
serveUrlOrWebpackUrl: string,
diff --git a/packages/renderer/src/get-silent-parts.ts b/packages/renderer/src/get-silent-parts.ts
index c45d0b2eda..fd587a335a 100644
--- a/packages/renderer/src/get-silent-parts.ts
+++ b/packages/renderer/src/get-silent-parts.ts
@@ -9,6 +9,18 @@ import type {LogLevel} from './log-level';
export type {SilentPart};
+/**
+ * Analyzes the silent parts of a video or audio file and returns both the silent and audible segments.
+ * @description Uses thresholds defined for noise and duration to identify silent stretches in a media file.
+ * @see [Documentation](https://remotion.dev/docs/renderer/get-silent-parts)
+ * @param {Object} params Configuration parameters for determining silent parts
+ * @param {string} params.src The path to the local video or audio file
+ * @param {number} [params.noiseThresholdInDecibels=-20] The decibel level below which sound is considered silent
+ * @param {number} [params.minDurationInSeconds=1] The minimum duration (in seconds) to consider a silence as significant
+ * @param {string|null} [params.binariesDirectory] Optional directory path for external binaries
+ * @param {LogLevel} [params.logLevel] The logging level to be used (debug, verbose, info, warn, error)
+ * @returns {Promise<GetSilentPartsResponse>} An object containing arrays of silent and audible parts, along with the overall duration
+ */
export const getSilentParts = async ({
src,
noiseThresholdInDecibels: passedNoiseThresholdInDecibels,
diff --git a/packages/renderer/src/render-frames.ts b/packages/renderer/src/render-frames.ts
index 0bddc874fc..cea5d95fd8 100644
--- a/packages/renderer/src/render-frames.ts
+++ b/packages/renderer/src/render-frames.ts
@@ -925,6 +925,8 @@ export const internalRenderFrames = wrapWithErrorHandling(
/**
* @description Renders a series of images using Puppeteer and computes information for mixing audio.
* @see [Documentation](https://www.remotion.dev/docs/renderer/render-frames)
+ * @param {RenderFramesOptions} options Configuration options for rendering frames.
+ * @returns {Promise<RenderFramesOutput>} Information about the rendered frames and assets.
*/
export const renderFrames = (
options: RenderFramesOptions,
diff --git a/packages/renderer/src/render-media.ts b/packages/renderer/src/render-media.ts
index e39b3a3137..2d59849885 100644
--- a/packages/renderer/src/render-media.ts
+++ b/packages/renderer/src/render-media.ts
@@ -795,9 +795,11 @@ export const internalRenderMedia = wrapWithErrorHandling(
);
/**
+ * Render a video from a composition. You can specify various options such as the codec, output location, input properties, and more.
+ * @see [Documentation](https://remotion.dev/docs/renderer/render-media)
+ * @param {RenderMediaOptions} options Configuration options for rendering the media.
+ * @returns {Promise<RenderMediaResult>} A promise that resolves to the rendering result, including a buffer and information about the slowest frames.
*
- * @description Render a video from a composition
- * @see [Documentation](https://www.remotion.dev/docs/renderer/render-media)
*/
export const renderMedia = ({
proResProfile,
diff --git a/packages/renderer/src/render-still.ts b/packages/renderer/src/render-still.ts
index 4fc2193be4..e63409af1b 100644
--- a/packages/renderer/src/render-still.ts
+++ b/packages/renderer/src/render-still.ts
@@ -408,9 +408,10 @@ export const internalRenderStill = wrapWithErrorHandling(
);
/**
- *
- * @description Render a still frame from a composition
- * @see [Documentation](https://www.remotion.dev/docs/renderer/render-still)
+ * @description Renders a single frame to an image and writes it to the specified output location.
+ * @see [Documentation](https://remotion.dev/docs/renderer/render-still)
+ * @param {RenderStillOptions} options Configuration options for rendering the still image
+ * @returns {Promise<RenderStillReturnValue>} A promise that resolves to an object with a buffer key containing the image data if no output path is defined, otherwise null.
*/
export const renderStill = (
options: RenderStillOptions,
diff --git a/packages/renderer/src/stitch-frames-to-video.ts b/packages/renderer/src/stitch-frames-to-video.ts
index a05478d4d5..74d176c35d 100644
--- a/packages/renderer/src/stitch-frames-to-video.ts
+++ b/packages/renderer/src/stitch-frames-to-video.ts
@@ -477,8 +477,10 @@ export const internalStitchFramesToVideo = async (
};
/**
- * @description Takes a series of images and audio information generated by renderFrames() and encodes it to a video.
+ * Takes a series of images and audio information generated by renderFrames() and encodes it to a video.
* @see [Documentation](https://www.remotion.dev/docs/renderer/stitch-frames-to-video)
+ * @param {StitchFramesToVideoOptions} options The configuration options for stitching frames into a video
+ * @returns {Promise<Buffer | null>} A promise that resolves with the video buffer or null if the output was written to a file
*/
export const stitchFramesToVideo = ({
assetsInfo,
diff --git a/packages/three/src/use-offthread-video-texture.ts b/packages/three/src/use-offthread-video-texture.ts
index 2b6061b268..f48f030e6b 100644
--- a/packages/three/src/use-offthread-video-texture.ts
+++ b/packages/three/src/use-offthread-video-texture.ts
@@ -98,6 +98,12 @@ export const useInnerVideoTexture = ({
return imageTexture;
};
+/**
+ * @description Allows you to use a video in React Three Fiber that is synchronized with Remotion's `useCurrentFrame()` using the `<OffthreadVideo>`.
+ * @see [Documentation](https://remotion.dev/docs/use-offthread-video-texture)
+ * @param {UseOffthreadVideoTextureOptions} options Configuration options including the video source (`src`), playback rate (`playbackRate`), transparency (`transparent`), and tone mapping (`toneMapped`).
+ * @returns {THREE.Texture | null} A THREE.Texture if available, otherwise null. To be used as a texture in 3D objects in React Three Fiber.
+ */
export function useOffthreadVideoTexture({
src,
playbackRate = 1,
diff --git a/packages/transitions/src/TransitionSeries.tsx b/packages/transitions/src/TransitionSeries.tsx
index 6428a10725..91283bb1a8 100644
--- a/packages/transitions/src/TransitionSeries.tsx
+++ b/packages/transitions/src/TransitionSeries.tsx
@@ -312,6 +312,12 @@ const TransitionSeriesChildren: FC<{readonly children: React.ReactNode}> = ({
return <>{childrenValue}</>;
};
+/**
+ * @description A React component designed to manage a series of transitions and sequences where each transition may have specific timing and presentation components. It extends the capabilities of `<Sequence>` and is specifically structured to handle transitions that involve entering and exiting sequences.
+ * @see [Documentation](https://remotion.dev/docs/transitions/transitionseries)
+ * @param {SequencePropsWithoutDuration} props The properties for setting the initial rendering behavior like from, name, etc. It additionally accepts children that are specifically `<TransitionSeries.Sequence>` or `<TransitionSeries.Transition>`.
+ * @returns React component that renders the transitions and sequences.
+ */
const TransitionSeries: FC<SequencePropsWithoutDuration> & {
Sequence: typeof SeriesSequence;
Transition: typeof TransitionSeriesTransition;
diff --git a/packages/transitions/src/presentations/clock-wipe.tsx b/packages/transitions/src/presentations/clock-wipe.tsx
index 536a74e87f..fc800caec6 100644
--- a/packages/transitions/src/presentations/clock-wipe.tsx
+++ b/packages/transitions/src/presentations/clock-wipe.tsx
@@ -79,6 +79,12 @@ const ClockWipePresentation: React.FC<
);
};
+/**
+ * Creates a clock wipe transition. This transition effect uses a circular wipe to reveal the underlying scene as the current scene exits.
+ * @see [Documentation](https://remotion.dev/docs/transitions/presentations/clock-wipe)
+ * @param {ClockWipeProps} props - The properties for the clock wipe effect, including dimensions and optional styles for entering and exiting states.
+ * @returns {TransitionPresentation<ClockWipeProps>} An object containing the ClockWipe component and its props to be used in transition presentations.
+ */
export const clockWipe = (
props: ClockWipeProps,
): TransitionPresentation<ClockWipeProps> => {
diff --git a/packages/transitions/src/presentations/fade.tsx b/packages/transitions/src/presentations/fade.tsx
index 12bf9ca8e6..2bca0794e5 100644
--- a/packages/transitions/src/presentations/fade.tsx
+++ b/packages/transitions/src/presentations/fade.tsx
@@ -31,6 +31,12 @@ const FadePresentation: React.FC<
return <AbsoluteFill style={style}>{children}</AbsoluteFill>;
};
+/**
+ * Provides a simple fade transition component for sliding elements in and out.
+ * @see [Documentation](https://remotion.dev/docs/transitions/presentations/fade)
+ * @param {FadeProps} [props] Optional properties to define 'enterStyle' and 'exitStyle'.
+ * @returns {TransitionPresentation<FadeProps>} The transition presentation component setup.
+ */
export const fade = (props?: FadeProps): TransitionPresentation<FadeProps> => {
return {
diff --git a/packages/transitions/src/presentations/flip.tsx b/packages/transitions/src/presentations/flip.tsx
index 26268ab618..9dc23bade1 100644
--- a/packages/transitions/src/presentations/flip.tsx
+++ b/packages/transitions/src/presentations/flip.tsx
@@ -84,6 +84,12 @@ const Flip: React.FC<TransitionPresentationComponentProps<FlipProps>> = ({
</AbsoluteFill>
);
};
+/**
+ * @description A presentation where the exiting slide flips by 180 degrees, revealing the next slide on the back side. This function configures a 3D flip effect for transitions between components in presentations.
+ * @see [Documentation](https://remotion.dev/docs/transitions/presentations/flip)
+ * @param {FlipProps} [props] Optional properties to configure the flip effect, including direction, perspective, and styles.
+ * @returns {TransitionPresentation<FlipProps>} An object with the Flip component and configuration properties.
+ */
export const flip = (props?: FlipProps): TransitionPresentation<FlipProps> => {
return {component: Flip, props: props ?? {}};
diff --git a/packages/transitions/src/presentations/slide.tsx b/packages/transitions/src/presentations/slide.tsx
index 4b9659edeb..dce21bc454 100644
--- a/packages/transitions/src/presentations/slide.tsx
+++ b/packages/transitions/src/presentations/slide.tsx
@@ -98,6 +98,12 @@ const SlidePresentation: React.FC<
return <AbsoluteFill style={style}>{children}</AbsoluteFill>;
};
+/**
+ * Implements a sliding transition for presentation components where the entering slide pushes out the exiting slide based on the specified direction.
+ * @see [Documentation](https://remotion.dev/docs/transitions/presentations/slide)
+ * @param {SlideProps} [props] Configuration options for the slide transition: includes direction, enterStyle, and exitStyle.
+ * @returns {TransitionPresentation<SlideProps>} Returns a transition configuration object including the component and its props.
+ */
export const slide = (
props?: SlideProps,
): TransitionPresentation<SlideProps> => {
diff --git a/packages/transitions/src/presentations/wipe.tsx b/packages/transitions/src/presentations/wipe.tsx
index b0251272f9..3f4477adc7 100644
--- a/packages/transitions/src/presentations/wipe.tsx
+++ b/packages/transitions/src/presentations/wipe.tsx
@@ -226,6 +226,12 @@ const WipePresentation: React.FC<
);
};
+/**
+ * @description A presentation where the entering slide slides over the exiting slide.
+ * @see [Documentation](https://remotion.dev/docs/transitions/presentations/wipe)
+ * @param {WipeProps} [props] - Optional properties to configure the transition.
+ * @returns {TransitionPresentation<WipeProps>} Transition presentation object setup for wipe effect.
+ */
export const wipe = (props?: WipeProps): TransitionPresentation<WipeProps> => {
return {
component: WipePresentation,
diff --git a/packages/transitions/src/timings/linear-timing.ts b/packages/transitions/src/timings/linear-timing.ts
index 09e428d398..d5a7972b11 100644
--- a/packages/transitions/src/timings/linear-timing.ts
+++ b/packages/transitions/src/timings/linear-timing.ts
@@ -1,6 +1,15 @@
import {interpolate} from 'remotion';
import type {TransitionTiming} from '../types.js';
+/**
+ * Creates a linear timing object for managing animations in frame units.
+ * @description Provides a mechanism to handle frame-based transitions linearly, optionally incorporating easing functions.
+ * @see [Documentation](https://remotion.dev/docs/transitions/timings/lineartiming)
+ * @param {Object} options Configuration options for the linear timing
+ * @param {number} options.durationInFrames Specifies the total duration of the transition in frames
+ * @param {((input: number) => number)=} options.easing Optional easing function to modify the interpolation of values
+ * @returns {TransitionTiming} An object representing the timing of the transition, including methods to get duration and progress
+ */
export const linearTiming = (options: {
durationInFrames: number;
easing?: ((input: number) => number) | undefined;