Skip to content

🎥 Make videos programmatically with React

chore: reference doc links in useCurrentFrame up to <Sequence />

alu-bosaeb3e74c52ed3
diff --git a/packages/cli/src/get-input-props.ts b/packages/cli/src/get-input-props.ts
index 6f1593ce90..cf15ad1177 100644
--- a/packages/cli/src/get-input-props.ts
+++ b/packages/cli/src/get-input-props.ts
@@ -4,6 +4,10 @@ import path from 'path';
import {Log} from './log';
import {parsedCli} from './parse-command-line';
+/**
+ * You ca retrieve inputs that you pass in, from the command line using --props, or the inputProps parameter if you're using the Node.js API
+ * @see [Documentation](https://www.remotion.dev/docs/get-input-props)
+ */
export const getInputProps = (onUpdate: (newProps: object) => void): object => {
if (!parsedCli.props) {
return {};
diff --git a/packages/core/src/Composition.tsx b/packages/core/src/Composition.tsx
index 522040620c..4edda2ae2c 100644
--- a/packages/core/src/Composition.tsx
+++ b/packages/core/src/Composition.tsx
@@ -50,6 +50,11 @@ const Fallback: React.FC = () => {
return null;
};
+/**
+ * This component is used to register a video to make it renderable and make it show in the sidebar, in dev mode.
+ * @see [Documentation](https://www.remotion.dev/docs/composition)
+ */
+
export const Composition = <T,>({
width,
height,
diff --git a/packages/core/src/Sequence.tsx b/packages/core/src/Sequence.tsx
index c47cfaa0fe..6e7d6dcff4 100644
--- a/packages/core/src/Sequence.tsx
+++ b/packages/core/src/Sequence.tsx
@@ -11,7 +11,10 @@ import {CompositionManager} from './CompositionManager.js';
import {useRemotionEnvironment} from './get-environment.js';
import {getTimelineClipName} from './get-timeline-clip-name.js';
import {useNonce} from './nonce.js';
-import {TimelineContext, useTimelinePosition} from './timeline-position-state.js';
+import {
+ TimelineContext,
+ useTimelinePosition,
+} from './timeline-position-state.js';
import {useVideoConfig} from './use-video-config.js';
export type SequenceContextType = {
@@ -221,6 +224,6 @@ const SequenceRefForwardingFunction: React.ForwardRefRenderFunction<
/**
* A component that time-shifts its children and wraps them in an absolutely positioned <div>.
- * @link https://www.remotion.dev/docs/sequence
+ * @see [Documentation](https://www.remotion.dev/docs/sequence]
*/
export const Sequence = forwardRef(SequenceRefForwardingFunction);
diff --git a/packages/core/src/audio/Audio.tsx b/packages/core/src/audio/Audio.tsx
index e3c3b98d0c..52ceb67ea6 100644
--- a/packages/core/src/audio/Audio.tsx
+++ b/packages/core/src/audio/Audio.tsx
@@ -103,4 +103,8 @@ const AudioRefForwardingFunction: React.ForwardRefRenderFunction<
);
};
+/**
+ * With this component, you can add audio to your video. All audio formats which are supported by Chromium are supported by the component.
+ * @see [Documentation](https://www.remotion.dev/docs/audio)
+ */
export const Audio = forwardRef(AudioRefForwardingFunction);
diff --git a/packages/core/src/cancel-render.ts b/packages/core/src/cancel-render.ts
index d6fef2b5b2..d5f9874046 100644
--- a/packages/core/src/cancel-render.ts
+++ b/packages/core/src/cancel-render.ts
@@ -30,6 +30,10 @@ const isErrorLike = (err: unknown): boolean => {
return true;
};
+/**
+ * When you invoke this function, Remotion will stop rendering all the frames without any retries
+ * @see [Documentation](https://www.remotion.dev/docs/cancel-render)
+ */
export function cancelRender(err: unknown): never {
let error: Error;
diff --git a/packages/core/src/delay-render.ts b/packages/core/src/delay-render.ts
index 0e957bbe15..007f2e7ed2 100644
--- a/packages/core/src/delay-render.ts
+++ b/packages/core/src/delay-render.ts
@@ -15,7 +15,7 @@ const defaultTimeout = 30000;
* Call this function to tell Remotion to wait before capturing this frame until data has loaded. Use continueRender() to unblock the render.
* @param label _optional_ A label to identify the call in case it does time out.
* @returns {number} An identifier to be passed to continueRender().
- * @link https://www.remotion.dev/docs/delay-render
+ * @see [Documentation](https://www.remotion.dev/docs/delay-render)
*/
export const delayRender = (label?: string): number => {
if (typeof label !== 'string' && typeof label !== 'undefined') {
@@ -59,7 +59,7 @@ export const delayRender = (label?: string): number => {
/**
* Unblock a render that has been blocked by delayRender()
* @param handle The return value of delayRender().
- * @link https://www.remotion.dev/docs/continue-render
+ * @see [Documentation](https://www.remotion.dev/docs/continue-render)
*/
export const continueRender = (handle: number): void => {
if (typeof handle === 'undefined') {
diff --git a/packages/core/src/get-static-files.ts b/packages/core/src/get-static-files.ts
index 72e105f5aa..efbdf610a5 100644
--- a/packages/core/src/get-static-files.ts
+++ b/packages/core/src/get-static-files.ts
@@ -23,6 +23,10 @@ const warnPlayerOnce = () => {
);
};
+/**
+ * The function array containing all files in the public/ folder. You can reference them by using staticFile().
+ * @see [Documentation](https://www.remotion.dev/docs/getstaticfiles)
+ */
export const getStaticFiles = (): StaticFile[] => {
if (typeof document === 'undefined') {
warnServerOnce();
diff --git a/packages/core/src/interpolate-colors.ts b/packages/core/src/interpolate-colors.ts
index 9bb08d79fe..abcddcf55a 100644
--- a/packages/core/src/interpolate-colors.ts
+++ b/packages/core/src/interpolate-colors.ts
@@ -472,6 +472,10 @@ const interpolateColorsRGB = (
return rgbaColor(r, g, b, a);
};
+/**
+ * This function allows you to map a range of values to colors using a concise syntax.
+ * @see [Documentation](https://www.remotion.dev/docs/interpolate-colors)
+ */
export const interpolateColors = (
input: number,
inputRange: readonly number[],
diff --git a/packages/core/src/interpolate.ts b/packages/core/src/interpolate.ts
index 7b0e47a7e1..ffaa3466d3 100644
--- a/packages/core/src/interpolate.ts
+++ b/packages/core/src/interpolate.ts
@@ -2,6 +2,11 @@
type ExtrapolateType = 'extend' | 'identity' | 'clamp';
+/**
+ * This function allows you to map a range of values to another with a conside syntax
+ * @see [Documentation](https://www.remotion.dev/docs/interpolate)
+ */
+
function interpolateFunction(
input: number,
inputRange: [number, number],
diff --git a/packages/core/src/prefetch.ts b/packages/core/src/prefetch.ts
index f48c6e0162..30b4679e8d 100644
--- a/packages/core/src/prefetch.ts
+++ b/packages/core/src/prefetch.ts
@@ -30,6 +30,10 @@ const blobToBase64 = function (blob: Blob): Promise<string> {
});
};
+/**
+ * When you call the preFetch() function, an asset will be fetched and kept in memory so it is ready when you want to play it in a <Player>.
+ * @see [Documentation](https://www.remotion.dev/docs/prefetch)
+ */
export const prefetch = (
src: string,
options?: {
diff --git a/packages/core/src/random.ts b/packages/core/src/random.ts
index 33ecb2fa65..53b1834fd2 100644
--- a/packages/core/src/random.ts
+++ b/packages/core/src/random.ts
@@ -25,7 +25,7 @@ export type RandomSeed = number | string | null;
/**
* A deterministic pseudo-random number generator.
* Pass in the same seed and get the same pseudorandom number.
- * See: https://remotion.dev/docs/random
+ * @see [Documentation](https://remotion.dev/docs/random)
*/
export const random = (seed: RandomSeed, dummy?: unknown) => {
if (dummy !== undefined) {
diff --git a/packages/core/src/register-root.ts b/packages/core/src/register-root.ts
index f2d17c8324..fe0bea7a30 100644
--- a/packages/core/src/register-root.ts
+++ b/packages/core/src/register-root.ts
@@ -4,6 +4,10 @@ let Root: React.FC | null = null;
let listeners: ((comp: React.FC) => void)[] = [];
+/**
+ * This function registers the root component of the Remotion project
+ * @see [Documentation](https://www.remotion.dev/docs/register-root)
+ */
export const registerRoot = (comp: React.FC) => {
if (!comp) {
throw new Error(
diff --git a/packages/core/src/spring/index.ts b/packages/core/src/spring/index.ts
index 287238a90d..a6997a2c10 100644
--- a/packages/core/src/spring/index.ts
+++ b/packages/core/src/spring/index.ts
@@ -7,7 +7,7 @@ import {springCalculation} from './spring-utils.js';
/**
* Calculates a position based on physical parameters, start and end value, and time.
- * @link https://www.remotion.dev/docs/spring
+ * @see [Documentation](https://www.remotion.dev/docs/spring)
* @param {number} frame The current time value. Most of the time you want to pass in the return value of useCurrentFrame.
* @param {number} fps The framerate at which the animation runs. Pass in the value obtained by `useVideoConfig()`.
* @param {?Object} config optional object that allows you to customize the physical properties of the animation.
diff --git a/packages/core/src/spring/measure-spring.ts b/packages/core/src/spring/measure-spring.ts
index 13e049797d..2e0a708843 100644
--- a/packages/core/src/spring/measure-spring.ts
+++ b/packages/core/src/spring/measure-spring.ts
@@ -2,6 +2,10 @@ import {validateFps} from '../validation/validate-fps.js';
import type {SpringConfig} from './spring-utils.js';
import {springCalculation} from './spring-utils.js';
+/**
+ * The function returns how long it takes for a spring animation to settle
+ * @see [Documentation](https://www.remotion.dev/docs/measure-spring)
+ */
export function measureSpring({
fps,
config = {},
diff --git a/packages/core/src/static-file.ts b/packages/core/src/static-file.ts
index 16857bee31..5eb98e6fbf 100644
--- a/packages/core/src/static-file.ts
+++ b/packages/core/src/static-file.ts
@@ -17,6 +17,7 @@ const inner = (path: string): string => {
/**
* Reference a file from the public/ folder.
* If the file does not appear in the autocomplete, type the path manually.
+ * @see [Documentation](https://www.remotion.dev/docs/staticfile)
*/
export const staticFile = (path: string) => {
if (path.startsWith('http://') || path.startsWith('https://')) {
diff --git a/packages/core/src/use-current-frame.ts b/packages/core/src/use-current-frame.ts
index 65e72adf09..cb6fe46a1d 100644
--- a/packages/core/src/use-current-frame.ts
+++ b/packages/core/src/use-current-frame.ts
@@ -6,7 +6,7 @@ import {useTimelinePosition} from './timeline-position-state.js';
/**
* Get the current frame of the video.
* Frames are 0-indexed, meaning the first frame is 0, the last frame is the duration of the composition in frames minus one.
- * @link https://www.remotion.dev/docs/use-current-frame
+ * @see [Documentation](https://remotion.dev/docs/use-current-frame)
*/
export const useCurrentFrame = (): number => {
const canUseRemotionHooks = useContext(CanUseRemotionHooks);
diff --git a/packages/core/src/use-video-config.ts b/packages/core/src/use-video-config.ts
index 84aabab730..911e3fb963 100644
--- a/packages/core/src/use-video-config.ts
+++ b/packages/core/src/use-video-config.ts
@@ -7,7 +7,7 @@ import type {VideoConfig} from './video-config.js';
/**
* Get some info about the context of the video that you are making.
* Returns an object containing `fps`, `width`, `height` and `durationInFrames`, all of type `number`.
- * @link https://www.remotion.dev/docs/use-video-config
+ * @see [Documentation](https://www.remotion.dev/docs/use-video-config)
*/
export const useVideoConfig = (): VideoConfig => {
const videoConfig = useUnsafeVideoConfig();