🎥 Make videos programmatically with React
mention order of operations
Jonny Burgerf0680fc1e34a
diff --git a/packages/docs/docs/spring.md b/packages/docs/docs/spring.mdindex 6318f621fa..bbce6fd289 100644--- a/packages/docs/docs/spring.md+++ b/packages/docs/docs/spring.md@@ -9,7 +9,7 @@ A physics-based animation primitive.Example:-```tsx twoslash+```tsx twoslash title="spring-example.ts"import { spring, useCurrentFrame, useVideoConfig } from "remotion";// ---cut---const frame = useCurrentFrame();@@ -26,33 +26,33 @@ const value = spring({## Parameters-### frame+### `frame`The current time value. Most of the time you want to pass in the return value of [`useCurrentFrame()`](/docs/use-current-frame). The spring animation starts at frame 0, so if you would like to delay the animation, you can pass a different value like `frame - 20`.-### from+### `from`_Default:_ `0`The initial value of the animation.-### to+### `to`_Default:_ `1`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.-### fps+### `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()`](/docs/use-video-config).-### reverse+### `reverse` <AvailableFrom v="3.3.92" />_Default:_ `false`-Render the animation in reverse. When this option is enabled, passing a `frame` is like passing `duration - frame`.+Render the animation in reverse. See: [Order or operations](#order-of-operations)-### config+### `config`An optional object that allows you to customize the physical properties of the animation.@@ -80,13 +80,13 @@ _Default_: `false`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`.-### durationInFrames <AvailableFrom v="3.0.27" />+### `durationInFrames` <AvailableFrom v="3.0.27" />_optional_Stretches the animation curve so it is exactly as long as you specify.-```tsx twoslash+```tsx twoslash title="spring-example.ts"import { spring, useCurrentFrame, useVideoConfig } from "remotion";// ---cut---const frame = useCurrentFrame();@@ -102,6 +102,8 @@ const value = spring({});```+See also: [Order or operations](#order-of-operations)+### `durationRestThreshold` <AvailableFrom v="3.0.27" />_optional_@@ -116,13 +118,15 @@ _optional_How many frames to delay the animation for.-For example, if a `delay` of `25` is given frames 0-24 will return the initial value, and the animation will effectively start from frame 25.+For example, if a `delay` of `25` is given frames 0-24 will return the initial value, and the animation will effectively start from frame 25. See also: [Order or operations](#order-of-operations)-## YouTube video+## Order of operations-Want to understand the different properties like `mass`, `stiffness`, `damping` etc.? We made a video trying to make sense of all the parameters!+Here is the order of which the `durationInFrames`, `reverse` and `delay` operations are applied:-Watch: **[The perfect spring animation](https://www.youtube.com/watch?v=GE8ZqrKqE5g)**+<Step>1</Step> First the spring animation is stretched to the duration that you pass using <a href="#durationinframes"><code>durationInFrames</code></a>, if you pass a duration.<br/>+<Step>2</Step> Then the animation is reversed if you pass <a href="#reverse-"><code>reverse: true</code></a>.<br/>+<Step>3</Step> Then the animation is delayed if you pass <a href="#delay-"><code>delay</code></a>.## Credit