Visualize Your Ideas With Code
feat(2d): visual feedback about rendering process (#681)
Jacobd0495f5c6396
diff --git a/packages/docs/docs/getting-started/rendering/index.mdx b/packages/docs/docs/getting-started/rendering/index.mdxindex ec25c212..49723fac 100644--- a/packages/docs/docs/getting-started/rendering/index.mdx+++ b/packages/docs/docs/getting-started/rendering/index.mdx@@ -102,18 +102,18 @@ installed and the default _Image sequence_ exporter will be used.## Rendering-Clicking the `RENDER` button will initialize rendering (The button will change-to `RENDERING` for the duration of the process). Motion Canvas will play through+Clicking the `RENDER` button will initialize rendering (The button will display+an in-progress animation during the process). Motion Canvas will play throughthe animation and save the result to `/output` in your project directory. Youcan [change the output directory](/docs/configuration#output) in the-configuration file. You can use the `OUTPUT DIRECTORY` button to reveal the+configuration file. You can also use the `OUTPUT DIRECTORY` button to reveal thecurrent output directory in your file explorer.The rendering process will finish once the button changes back to `RENDER`.Usually, this happens when the playhead reaches the end of the selected rangebut some exporters may take longer to finish processing the frames.-You can also abort the process at any time by pressing the `RENDERING` button.+You can abort the process at any time by pressing the `ABORT` button.## Taking Snapshotsdiff --git a/packages/ui/src/components/controls/Button.tsx b/packages/ui/src/components/controls/Button.tsxindex 2828389a..e9de9ecb 100644--- a/packages/ui/src/components/controls/Button.tsx+++ b/packages/ui/src/components/controls/Button.tsx@@ -2,14 +2,21 @@ import styles from './Controls.module.scss';import type {JSX} from 'preact';import clsx from 'clsx';-export interface ButtonProps extends JSX.HTMLAttributes<HTMLButtonElement> {+export interface ButtonProps+ extends Omit<JSX.HTMLAttributes<HTMLButtonElement>, 'loading'> {main?: boolean;+ loading?: boolean;}-export function Button({main, className, ...props}: ButtonProps) {+export function Button({main, loading, className, ...props}: ButtonProps) {return (<button- className={clsx(styles.button, className, main && styles.main)}+ className={clsx(+ styles.button,+ className,+ main && styles.main,+ loading && 'loading',+ )}onMouseUp={event => (event.target as HTMLButtonElement).blur()}type={'button'}{...props}diff --git a/packages/ui/src/components/controls/Controls.module.scss b/packages/ui/src/components/controls/Controls.module.scssindex 472d25fb..88cfee17 100644--- a/packages/ui/src/components/controls/Controls.module.scss+++ b/packages/ui/src/components/controls/Controls.module.scss@@ -84,6 +84,7 @@}&.main {+ --loading-stripe-color: var(--theme-light);background-color: var(--theme);color: rgba(0, 0, 0, 0.87);font-weight: bold;diff --git a/packages/ui/src/components/sidebar/VideoSettings.tsx b/packages/ui/src/components/sidebar/VideoSettings.tsxindex 4a60fd99..426a2b84 100644--- a/packages/ui/src/components/sidebar/VideoSettings.tsx+++ b/packages/ui/src/components/sidebar/VideoSettings.tsx@@ -81,6 +81,7 @@ function ProcessButton({processId, setProcess}: ProcessButtonProps) {) : (<Buttonmain+ loadingid="render"data-rendering={true}disabled={rendererState === RendererState.Aborting}diff --git a/packages/ui/src/index.scss b/packages/ui/src/index.scssindex 53fc921f..7ef78ab4 100644--- a/packages/ui/src/index.scss+++ b/packages/ui/src/index.scss@@ -2,6 +2,7 @@:root {--theme: #33a6ff;+ --theme-light: #52bbff;--theme-overlay: rgba(51, 166, 255, 0.24);--background-color: #181818;--background-color-dark: #141414;@@ -84,3 +85,30 @@ button {border: 0;padding: 0;}++.loading {+ --loading-stripe-color: var(--surface-color-hover);++ background-image: linear-gradient(+ 45deg,+ var(--loading-stripe-color) 25%,+ #0000 25%,+ #0000 50%,+ var(--loading-stripe-color) 50%,+ var(--loading-stripe-color) 75%,+ #0000 75%,+ #0000 100%+ );++ background-size: 22.63px 22.63px;+ animation: loading 1s linear infinite;+}++@keyframes loading {+ 0% {+ background-position: 0 0;+ }+ 100% {+ background-position: 22.63px 0;+ }+}