Skip to content

🎥 Make videos programmatically with React

adjust JSDoc

Jonny Burgerceb29af2e932
diff --git a/packages/core/src/interpolate.ts b/packages/core/src/interpolate.ts
index 14ab88658a..7b0e47a7e1 100644
--- a/packages/core/src/interpolate.ts
+++ b/packages/core/src/interpolate.ts
@@ -100,15 +100,14 @@ function checkInfiniteRange(name: string, arr: readonly number[]) {
}
/**
- * Compute value based on an input number based on an interpolation function between input range and output range
- * Some options could be defined in order to handle extrapolations and easings.
+ * Map a value from an input range to an output range.
* @link https://www.remotion.dev/docs/interpolate
- * @param {!number} input entry value used in interpolation function (example: currentFrame index)
+ * @param {!number} input value to interpolate
* @param {!number[]} inputRange range of values that you expect the input to assume.
* @param {!number[]} outputRange range of output values that you want the input to map to.
* @param {?object} options
* @param {?Function} options.easing easing function which allows you to customize the input, for example to apply a certain easing function. By default, the input is left unmodified, resulting in a pure linear interpolation {@link https://www.remotion.dev/docs/easing}
- * @param {string=} [options.extrapolateLeft="extend"] What should happen if the input value is outside left the input range {@link https://www.remotion.dev/docs/interpolate#extrapolateleft}
+ * @param {string=} [options.extrapolateLeft="extend"] What should happen if the input value is outside left the input range, default: "extend" {@link https://www.remotion.dev/docs/interpolate#extrapolateleft}
* @param {string=} [options.extrapolateRight="extend"] Same as extrapolateLeft, except for values outside right the input range {@link https://www.remotion.dev/docs/interpolate#extrapolateright}
*/
export function interpolate(
@@ -175,4 +174,4 @@ export function interpolate(
extrapolateRight,
}
);
-}
\ No newline at end of file
+}
diff --git a/packages/core/src/spring/index.ts b/packages/core/src/spring/index.ts
index a685fad92b..ae96ed5773 100644
--- a/packages/core/src/spring/index.ts
+++ b/packages/core/src/spring/index.ts
@@ -1,17 +1,17 @@
import {springCalculation, SpringConfig} from './spring-utils';
/**
- * Delightful and smooth animation primitive. Calculates a position based on physical parameters, start and end value, and time
+ * Calculates a position based on physical parameters, start and end value, and time.
* @link 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 For how many frames per second the spring animation should be calculated.
+ * @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.
* @param {number} [config.mass=1] The weight of the spring. If you reduce the mass, the animation becomes faster!
* @param {number} [config.damping=10] How hard the animation decelerates.
- * @param {number} [config.stiffness=100] How hard the animation decelerates.
- * @param {boolean} [config.overshootClamping=false] How hard the animation decelerates.
- * @param {?number} from The initial value of the animation
- * @param {?number} to The end value of the animation. Note that depending on the parameters, spring animations may overshoot the target a bit, before they bounce back to their final target.
+ * @param {number} [config.stiffness=100] Affects bounciness of the animation.
+ * @param {boolean} [config.overshootClamping=false] Whether to prevent the animation going beyond the target value.
+ * @param {?number} from The initial value of the animation. Default `0`
+ * @param {?number} to The end value of the animation. Default `1`
*/
export function spring({
frame,
diff --git a/packages/core/src/use-video-config.ts b/packages/core/src/use-video-config.ts
index 49bfcfdf44..bc9027cd38 100644
--- a/packages/core/src/use-video-config.ts
+++ b/packages/core/src/use-video-config.ts
@@ -1,18 +1,10 @@
import {useUnsafeVideoConfig} from './use-unsafe-video-config';
import {VideoConfig} from './video-config';
-/**
- * @typedef {Object} VideoConfig - configuration of current generated video
- * @property {number} width - width of the composition in pixels
- * @property {number} height - height of the composition in pixels
- * @property {number} fps - frame rate of the composition, in frames per seconds
- * @property {number} durationInFrame - duration of the composition in frames
- */
-
/**
* 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
- * @return {VideoConfig}
*/
export const useVideoConfig = (): VideoConfig => {
const videoConfig = useUnsafeVideoConfig();
diff --git a/packages/docs/docs/spring.md b/packages/docs/docs/spring.md
index b17d03f162..ca6686bfd2 100644
--- a/packages/docs/docs/spring.md
+++ b/packages/docs/docs/spring.md
@@ -44,7 +44,7 @@ The end value of the animation. Note that depending on the parameters, spring an
### fps
-For how many frames per second the spring animation should be calculated. This should always be the `fps` property of the return value of `useVideoConfig()`.
+For how many frames per second the spring animation should be calculated. This should always be the `fps` property of the return value of [`useVideoConfig()`](/docs/use-video-config).
### config