Visualize Your Ideas With Code
docs: clarify corner smoothing (#731)
Jacobc5b7107a2d41
diff --git a/packages/2d/src/components/Icon.ts b/packages/2d/src/components/Icon.tsindex 800d5f98..2b325d2e 100644--- a/packages/2d/src/components/Icon.ts+++ b/packages/2d/src/components/Icon.ts@@ -17,7 +17,7 @@ export interface IconProps extends ImgProps {}/**- * An Icon Component that provides an easy access to over 150k icons.+ * An Icon Component that provides easy access to over 150k icons.* See https://icones.js.org/collection/all for all available Icons.*/export class Icon extends Img {diff --git a/packages/2d/src/components/Rect.ts b/packages/2d/src/components/Rect.tsindex 0be7e7de..c053ef27 100644--- a/packages/2d/src/components/Rect.ts+++ b/packages/2d/src/components/Rect.ts@@ -10,6 +10,9 @@ import {spacingSignal} from '../decorators/spacingSignal';import {SignalValue, SimpleSignal} from '@motion-canvas/core/lib/signals';export interface RectProps extends ShapeProps {+ /**+ * {@inheritDoc Rect.radius}+ */radius?: SignalValue<PossibleSpacing>;/**@@ -24,18 +27,60 @@ export interface RectProps extends ShapeProps {}export class Rect extends Shape {+ /**+ * Rounds the corners of this rectangle.+ *+ * @remarks+ * The value represents the radius of the quarter circle that is used to round+ * the corners. If the value is a number, the same radius is used for all+ * corners. Passing an array of two to four numbers will set individual radii+ * for each corner. Individual radii correspond to different corners depending+ * on the number of values passed:+ *+ * ```ts+ * // top-left-and-bottom-right | top-right-and-bottom-left+ * [10, 30]+ * // top-left | top-right-and-bottom-left | bottom-right+ * [10, 20, 30]+ * // top-left | top-right | bottom-right | bottom-left+ * [10, 20, 30, 40]+ * ```+ *+ * @example+ * One uniform radius:+ * ```tsx+ * <Rect+ * size={320}+ * radius={40}+ * fill={'white'}+ * />+ * ```+ * @example+ * Individual radii for each corner:+ * ```tsx+ * <Rect+ * size={320}+ * radius={[10, 20, 30, 40]}+ * fill={'white'}+ * />+ * ```+ */@spacingSignal('radius')public declare readonly radius: SpacingSignal<this>;/**- * Will set the corner drawing method to smooth corners.+ * Enables corner smoothing.** @remarks- * Smooth corners are drawn continuously by a bezìer curves, rather than by a- * quarter circle.+ * This property only affects the way rounded corners are drawn. To control+ * the corner radius use the {@link radius} property.+ *+ * When enabled, rounded corners are drawn continuously using Bézier curves+ * rather than quarter circles. The sharpness of the curve can be controlled+ * with {@link cornerSharpness}.*- * When `smoothCorners` is set to `true`, the sharpness of the curve can be- * controlled by the {@link Rect.cornerSharpness}.+ * You can read more about corner smoothing in+ * [this article by Nick Lawrence](https://uxplanet.org/ui-ux-design-corner-smoothing-720509d1ae48).** @example* ```tsx@@ -51,18 +96,20 @@ export class Rect extends Shape {public declare readonly smoothCorners: SimpleSignal<boolean, this>;/**- * Controls the sharpness of the corners. {@link Rect.smoothCorners} must- * be set to `true`.+ * Controls the sharpness of {@link smoothCorners}.** @remarks- * By default the `cornerSharpness` is set to `0.6` which represents smooth,+ * This property only affects the way rounded corners are drawn. To control+ * the corner radius use the {@link radius} property.+ *+ * Requires {@link smoothCorners} to be enabled to have any effect.+ * By default, corner sharpness is set to `0.6` which represents a smooth,* circle-like rounding. At `0` the edges are squared off.** @example* ```tsx* <Rect- * width={300}- * height={300}+ * size={300}* smoothCorners={true}* cornerSharpness={0.7}* />diff --git a/packages/docs/blog/2023-05-29-version-3.9.0.mdx b/packages/docs/blog/2023-05-29-version-3.9.0.mdxindex 8e2bc7de..936d7025 100644--- a/packages/docs/blog/2023-05-29-version-3.9.0.mdx+++ b/packages/docs/blog/2023-05-29-version-3.9.0.mdx@@ -42,7 +42,7 @@ import {CodeBlock, insert} from '@motion-canvas/2d/lib/components/CodeBlock';`}<Issue user={'ajs1998'} pr={709}>New{' '}<Link to="/api/core/scenes/Random#guass">- <code>Random.guass()</code>+ <code>Random.gauss()</code></Link>{' '}method lets you generate random numbers using a gaussian (normal)distribution.