🎥 Make videos programmatically with React
tweak measureSpring docs a bit
Jonny Burgera99bc7b2edff
diff --git a/packages/docs/docs/measure-spring.md b/packages/docs/docs/measure-spring.mdindex 0cc3eb2e82..a70eb6a5ce 100644--- a/packages/docs/docs/measure-spring.md+++ b/packages/docs/docs/measure-spring.md@@ -3,78 +3,65 @@ title: measureSpring()id: measure-spring----Based on a spring configuration and the FPS, return how long in frame it takes for the spring to settle.+Based on a spring configuration and the frame rate, return how long it takes for a spring animation to settle.+```tsx+import {+ measureSpring,+ SpringConfig+} from 'remotion';-:::caution--Warning! The longer the animation, the more important the calculation.-Having a long animation and using `measureSpring()` may cause slowdowns--:::-```tsx-import {measureSpring, useCurrentFrame} from 'remotion';--const videoConfig = useVideoConfig();--const config = {- damping: 10,- mass: 0.7,- stiffness: 40,- overshootClamping: false,+const config: SpringConfig = {+ damping: 200,}measureSpring({- config,- fps: videoConfig.fps,- from: 0,- to: 1,-}); // 73+ fps: 30,+ config: {+ damping: 200+ }+}); // => 23```-## Parameters--### from--The initial value of the animation.--### to+:::info+Theoretically, a spring animation never ends. There is always a miniscule amount or energy left in the spring that causes tiny movements. Instead, we set a threshold to define when the spring animation is considered done.+:::-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.+## Arguments-### fps+An object with these keys:-For how many frames per second the spring animation should be calculated. Better using the `fps` property of the return value of `useVideoConfig()` or the same value.+### `fps`-### config+The frame rate on which the spring animation is based on.-An optional object that allows you to customize the physical properties of the animation.+### `threshold`-#### mass+_optional - default: `0.005`_-_Default:_ `1`+Defines when the animation should be considered finished. `0.01` means that the animation is finished when it always stays within 1% of the `to` value. For example an animation that goes from 0 to 1 is considered finished when the value never leaves the range [0.99, 1.01] after the end point.-The weight of the spring. If you reduce the mass, the animation becomes faster!+Lower values mean the spring duration is longer, higher values result in the spring duration being shorter.-#### Damping+### `config?`-_Default_: `10`+_optional_-How hard the animation decelerates.+The spring configuration that you pass to [spring()](/docs/spring#config).-#### Stiffness+### `from?`-_Default_: `100`+_optional - default: `1`_-Spring stiffness coefficient. Play with this one and it will affect how bouncy your animation is.+The initial value of the animation.-#### overshootClamping+### `to?`-_Default_: `false`+_optional - default: `1`_-Determines whether the animation can shoot over the `to` value. If set to true, if the animation goes over `to`, it will just return the value of `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.## See also-- [useVideoConfig()](/docs/use-video-config)+- [spring()](/docs/spring)diff --git a/packages/docs/docs/spring.md b/packages/docs/docs/spring.mdindex c5a6d3b7ce..7615443ad2 100644--- a/packages/docs/docs/spring.md+++ b/packages/docs/docs/spring.md@@ -80,4 +80,5 @@ This function was taken from [Reanimated 2](https://github.com/software-mansion/## See also-- [interpolate](/docs/interpolate)+- [interpolate()](/docs/interpolate)+- [measureSpring()](/docs/measure-spring)