Skip to content

Visualize Your Ideas With Code

docs: update rendering section

aarthificial9266f6f064c8
diff --git a/packages/docs/docs/getting-started/configuration.mdx b/packages/docs/docs/getting-started/configuration.mdx
index 382c61e4..60fe3ca9 100644
--- a/packages/docs/docs/getting-started/configuration.mdx
+++ b/packages/docs/docs/getting-started/configuration.mdx
@@ -25,11 +25,12 @@ export default defineConfig({
- Type: `string | string[]`
- Default: `./src/project.ts`
-The import path of the project file, relative to the configuration file.
-A project file must contain a default export with an instance of the `Project` class.
+The import path of the project file, relative to the configuration file. A
+project file must contain a default export with an instance of the `Project`
+class.
-When set to an array, the Editor will display a project selection screen,
-making it possible to change the project without restarting Vite.
+When set to an array, the Editor will display a project selection screen, making
+it possible to change the project without restarting Vite.
```ts
motionCanvas({
@@ -46,7 +47,8 @@ motionCanvas({
- Type: `string`
- Default: `./output`
-An output path to which the animation will be saved. Relative to the configuration file.
+An output path to which the animation will be saved. Relative to the
+configuration file.
When rendering, the complete path has the following format:
@@ -62,19 +64,19 @@ Stills are saved to a `still` subdirectory:
### `bufferedAssets`
-- Type: `RegExp`
-- Default: `/\.(wav|mp3|ogg)$/`
+- Type: RegExp | false
+- Default: `/\.(wav|ogg)$/`
Defines which assets should be buffered before being sent to the browser.
Streaming larger assets directly from the drive my cause issues with other
-applications. For instance, if an audio file is being used in the project,
-Adobe Audition will perceive it as "being used by another application"
-and refuse to override it.
+applications. For instance, if an audio file is being used in the project, Adobe
+Audition will perceive it as "being used by another application" and refuse to
+override it.
-Buffered assets are first loaded to the memory and then streamed from
-there. This leaves the original files open for modification with hot module
-replacement still working.
+Buffered assets are first loaded to the memory and then streamed from there.
+This leaves the original files open for modification with hot module replacement
+still working.
### `editor`
@@ -83,9 +85,9 @@ replacement still working.
The import path of the editor package.
-This option can be used to develop/use an editor different than the official one.
-The path will be resolved using Node.js module resolution rules.
-It should lead to a directory containing the following files:
+This option can be used to develop/use an editor different than the official
+one. The path will be resolved using Node.js module resolution rules. It should
+lead to a directory containing the following files:
- `editor.html` - The HTML template for the editor.
- `styles.css` - The editor styles.
@@ -95,5 +97,5 @@ It should lead to a directory containing the following files:
- `editor` - Receives the project factory as its first argument and creates the
user interface.
-- `index` - Receives a list of all projects as its first argument and
- creates the initial page for selecting a project.
+- `index` - Receives a list of all projects as its first argument and creates
+ the initial page for selecting a project.
diff --git a/packages/docs/docs/getting-started/rendering.md b/packages/docs/docs/getting-started/rendering.mdx
similarity index 54%
rename from packages/docs/docs/getting-started/rendering.md
rename to packages/docs/docs/getting-started/rendering.mdx
index d3b0cb04..261df9d2 100644
--- a/packages/docs/docs/getting-started/rendering.md
+++ b/packages/docs/docs/getting-started/rendering.mdx
@@ -2,27 +2,28 @@
sidebar_position: 9
---
-# Rendering
+import {VideoSettings} from '@site/src/Icon/VideoSettings';
+import {PhotoCamera} from '@site/src/Icon/PhotoCamera';
-To render an animation, open the Rendering panel in the top left of the screen
-using the button with the icon below.
+# Rendering
-![The icon used to identify the rendering panel tab.](/img/rendering_icon.svg)
+To render an animation, open the Rendering tab using the <VideoSettings
+ className="icon-inline"
+ alt="Video Settings"
+ title="Video Settings"
+/> icon. Here, you can configure the output settings of your animation as well
+as initialize the rendering process.
-You should see a panel titled "RENDERING" with several fields and a Render
-button. The default settings are sufficient to render the animation, but we will
-explore some of the options.
+## Configuration
-### Options
+### Range
-##### Range
+The Range is the span of frames that will be rendered. If set to a smaller range
+than the entire length of the video, it will only render a portion of the frames
+in your animation. This can be useful for quickly rendering small changes in
+your animation.
-The Range is the span of frames that will render. If set to a smaller range than
-the entire length of the video, it will only render a portion of the frames in
-your animation. This can be useful for quickly rendering small changes in your
-animation.
-
-##### Frame rate
+### Frame rate
The frame rate at which the preview plays and the number of frames that will
render per one second of runtime. The most common values are 24, 30, and 60,
@@ -30,14 +31,14 @@ though any whole integer value is allowed. Motion Canvas animations are
resilient to changes in frame rate, so most animations will not be affected by
changing it.
-##### Resolution
+### Resolution
The resolution in pixels of each frame in the video. You may use this value to
render in a higher resolution or to change the aspect ratio. Note, however, that
animations will not scale with changes in resolution, so plan ahead for any
adjustments to resolution.
-##### Scale
+### Scale
Scale will increase or decrease the resolution of the animation, but, unlike the
Resolution option, the coordinates and size of animation elements will be
@@ -45,20 +46,20 @@ adjusted as well. You may use this option to render in multiple different
resolution densities or to adjust your output resolution after completing an
animation.
-##### Color Space
+### Color Space
The HTML Canvas color space to use when previewing or rendering the animation.
Current options include sRGB, a common color space for images and video, and
DCI-P3, a wide-gamut color space.
-##### File Type
+### File Type
The type of image file to which Motion Canvas will convert the frames. Current
options are PNG, JPEG, and WebP. Note that Motion Canvas depends on the
capabilities of your browser to generate image files, and so WebP may not work
on Safari or older browsers.
-##### Quality
+### Quality
The quality target for compression from 0 to 1, where a lower setting will
result in smaller file sizes but might degrade image quality. A setting of 1
@@ -67,22 +68,23 @@ will often produce no discernible difference. Note that output to a file type of
PNG does not allow for different quality settings, so this option will be
ignored when outputting to PNG.
-### The Output
-
-After clicking the Render button, Motion Canvas will play through the animation
-and save each frame as an image to `/output` in your project directory. The
-target output direction may be configured in `vite.config.js`, however, by
-setting the `output` property in the `motionCanvas` plugin options.
-
-```js
-export default defineConfig({
- plugins: [
- motionCanvas({
- output: './custom',
- }),
- ],
-});
-```
-
-You may then import your animation as frames into a video editor of your choice,
-or convert the frames directly to a video using a tool like `ffmpeg`.
+## Rendering
+
+Clicking the `RENDER` button will initialize rendering. Motion Canvas will play
+through the animation and save each frame as an image to `/output` in your
+project directory. You can
+[change the output directory](/docs/configuration#output) in the configuration
+file.
+
+The rendering process will finish once the playhead reaches the end of the
+selected range. You can also stop the process at any time by pressing the
+`RENDER` button again.
+
+After rendering, you can import the rendered image sequence into a video editor
+of your choice, or convert the frames directly to a video using a tool like
+`ffmpeg`.
+
+## Taking Snapshots
+
+You can use the <PhotoCamera className="icon-inline"/> icon take a snapshot of
+the current frame. Snapshots are saved in the output directory, under `/still`.
diff --git a/packages/docs/src/Icon/PhotoCamera/index.tsx b/packages/docs/src/Icon/PhotoCamera/index.tsx
new file mode 100644
index 00000000..3b418176
--- /dev/null
+++ b/packages/docs/src/Icon/PhotoCamera/index.tsx
@@ -0,0 +1,20 @@
+import React, {ComponentProps} from 'react';
+
+export function PhotoCamera({
+ width = 24,
+ height = 24,
+ ...props
+}: ComponentProps<'svg'>): JSX.Element {
+ return (
+ <svg
+ width={width}
+ height={height}
+ viewBox="0 0 24 24"
+ fill="currentColor"
+ {...props}
+ >
+ <circle cx="12" cy="12" r="3.2" />
+ <path d="M9 2L7.17 4H4c-1.1 0-2 .9-2 2v12c0 1.1.9 2 2 2h16c1.1 0 2-.9 2-2V6c0-1.1-.9-2-2-2h-3.17L15 2H9zm3 15c-2.76 0-5-2.24-5-5s2.24-5 5-5 5 2.24 5 5-2.24 5-5 5z" />
+ </svg>
+ );
+}
diff --git a/packages/docs/src/Icon/VideoSettings/index.tsx b/packages/docs/src/Icon/VideoSettings/index.tsx
new file mode 100644
index 00000000..cf7b23b5
--- /dev/null
+++ b/packages/docs/src/Icon/VideoSettings/index.tsx
@@ -0,0 +1,25 @@
+import React, {ComponentProps} from 'react';
+
+export function VideoSettings({
+ width = 24,
+ height = 24,
+ ...props
+}: ComponentProps<'svg'>): JSX.Element {
+ return (
+ <svg
+ width={width}
+ height={height}
+ viewBox="0 0 24 24"
+ fill="currentColor"
+ {...props}
+ >
+ <g>
+ <g>
+ <path d="M3,6h18v5h2V6c0-1.1-0.9-2-2-2H3C1.9,4,1,4.9,1,6v12c0,1.1,0.9,2,2,2h9v-2H3V6z" />
+ <polygon points="15,12 9,8 9,16" />
+ <path d="M22.71,18.43c0.03-0.29,0.04-0.58,0.01-0.86l1.07-0.85c0.1-0.08,0.12-0.21,0.06-0.32l-1.03-1.79 c-0.06-0.11-0.19-0.15-0.31-0.11L21.23,15c-0.23-0.17-0.48-0.31-0.75-0.42l-0.2-1.36C20.26,13.09,20.16,13,20.03,13h-2.07 c-0.12,0-0.23,0.09-0.25,0.21l-0.2,1.36c-0.26,0.11-0.51,0.26-0.74,0.42l-1.28-0.5c-0.12-0.05-0.25,0-0.31,0.11l-1.03,1.79 c-0.06,0.11-0.04,0.24,0.06,0.32l1.07,0.86c-0.03,0.29-0.04,0.58-0.01,0.86l-1.07,0.85c-0.1,0.08-0.12,0.21-0.06,0.32l1.03,1.79 c0.06,0.11,0.19,0.15,0.31,0.11l1.27-0.5c0.23,0.17,0.48,0.31,0.75,0.42l0.2,1.36c0.02,0.12,0.12,0.21,0.25,0.21h2.07 c0.12,0,0.23-0.09,0.25-0.21l0.2-1.36c0.26-0.11,0.51-0.26,0.74-0.42l1.28,0.5c0.12,0.05,0.25,0,0.31-0.11l1.03-1.79 c0.06-0.11,0.04-0.24-0.06-0.32L22.71,18.43z M19,19.5c-0.83,0-1.5-0.67-1.5-1.5s0.67-1.5,1.5-1.5s1.5,0.67,1.5,1.5 S19.83,19.5,19,19.5z" />
+ </g>
+ </g>
+ </svg>
+ );
+}
diff --git a/packages/docs/src/css/custom.css b/packages/docs/src/css/custom.css
index 1de4d7bb..6b773417 100644
--- a/packages/docs/src/css/custom.css
+++ b/packages/docs/src/css/custom.css
@@ -177,3 +177,8 @@ html[data-theme='dark'] .navbar-github-link::before {
color: var(--ifm-link-color);
border-color: var(--ifm-color-primary);
}
+
+.icon-inline {
+ vertical-align: text-bottom;
+ margin: 0 0.3rem;
+}