🎥 Make videos programmatically with React
docs: add jsdoc on some core API methods
Antoine Caron82e528a9c592
diff --git a/packages/core/src/interpolate.ts b/packages/core/src/interpolate.tsindex 6a5cb42496..14ab88658a 100644--- a/packages/core/src/interpolate.ts+++ b/packages/core/src/interpolate.ts@@ -99,6 +99,18 @@ 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.+ * @link https://www.remotion.dev/docs/interpolate+ * @param {!number} input entry value used in interpolation function (example: currentFrame index)+ * @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.extrapolateRight="extend"] Same as extrapolateLeft, except for values outside right the input range {@link https://www.remotion.dev/docs/interpolate#extrapolateright}+ */export function interpolate(input: number,inputRange: readonly number[],@@ -163,4 +175,4 @@ export function interpolate(extrapolateRight,});-}+}\ No newline at end of filediff --git a/packages/core/src/spring/index.ts b/packages/core/src/spring/index.tsindex cf594f90f4..a685fad92b 100644--- a/packages/core/src/spring/index.ts+++ b/packages/core/src/spring/index.ts@@ -1,5 +1,18 @@import {springCalculation, SpringConfig} from './spring-utils';+/**+ * Delightful and smooth animation primitive. 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 {?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.+ */export function spring({frame,fps,diff --git a/packages/core/src/use-frame.ts b/packages/core/src/use-frame.tsindex f8704f5c6e..ac66edafe8 100644--- a/packages/core/src/use-frame.ts+++ b/packages/core/src/use-frame.ts@@ -8,6 +8,11 @@ export const useAbsoluteCurrentFrame = (): number => {return timelinePosition;};+/**+ * 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+ */export const useCurrentFrame = (): number => {const frame = useAbsoluteCurrentFrame();const context = useContext(SequenceContext);diff --git a/packages/core/src/use-video-config.ts b/packages/core/src/use-video-config.tsindex 47bc7094e2..49bfcfdf44 100644--- a/packages/core/src/use-video-config.ts+++ b/packages/core/src/use-video-config.ts@@ -1,6 +1,19 @@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.+ * @link https://www.remotion.dev/docs/use-video-config+ * @return {VideoConfig}+ */export const useVideoConfig = (): VideoConfig => {const videoConfig = useUnsafeVideoConfig();