🎥 Make videos programmatically with React
new defaults and remove edgeRoundness
Jonny Burger3828141c70e3
diff --git a/packages/docs/components/demos/Arrow.tsx b/packages/docs/components/demos/Arrow.tsxindex 963af8bde9..23b80ff0ff 100644--- a/packages/docs/components/demos/Arrow.tsx+++ b/packages/docs/components/demos/Arrow.tsx@@ -8,7 +8,6 @@ export const ArrowDemo: React.FC<{readonly headWidth: number;readonly headLength: number;readonly shaftWidth: number;- readonly edgeRoundness: ArrowProps['edgeRoundness'];readonly darkMode: boolean;readonly direction: ArrowProps['direction'];readonly cornerRadius: number;@@ -17,7 +16,6 @@ export const ArrowDemo: React.FC<{headWidth,headLength,shaftWidth,- edgeRoundness,direction,cornerRadius,darkMode,@@ -38,7 +36,6 @@ export const ArrowDemo: React.FC<{headWidth={headWidth}headLength={safeHeadLength}shaftWidth={safeShaftWidth}- edgeRoundness={edgeRoundness}direction={direction}cornerRadius={cornerRadius}/>diff --git a/packages/docs/components/demos/types.ts b/packages/docs/components/demos/types.tsindex 92185d2da7..6c0d52a660 100644--- a/packages/docs/components/demos/types.ts+++ b/packages/docs/components/demos/types.ts@@ -96,7 +96,7 @@ export const arrowDemo: DemoType = {optional: 'no',},{- default: 120,+ default: 185,max: 400,step: 5,min: 1,@@ -114,7 +114,7 @@ export const arrowDemo: DemoType = {optional: 'no',},{- default: 60,+ default: 80,max: 400,step: 5,min: 1,@@ -138,15 +138,6 @@ export const arrowDemo: DemoType = {type: 'numeric',optional: 'no',},- {- name: 'edgeRoundness',- default: 1,- max: 2,- min: -2,- step: 0.01,- type: 'numeric',- optional: 'default-disabled',- },],};diff --git a/packages/docs/components/shapes/shapes-info.tsx b/packages/docs/components/shapes/shapes-info.tsxindex a5ebf2fcdc..e05932cdb8 100644--- a/packages/docs/components/shapes/shapes-info.tsx+++ b/packages/docs/components/shapes/shapes-info.tsx@@ -36,39 +36,35 @@ export const shapeComponents: ShapeComponent[] = [{name: 'length',type: 'number',- description: 'The total length of the arrow along its direction axis.',+ description:+ 'The total length of the arrow along its direction axis. Default 300.',},{name: 'headWidth',type: 'number',- description: 'The width of the arrowhead at its widest point.',+ description:+ 'The width of the arrowhead at its widest point. Default 185.',},{name: 'headLength',type: 'number',- description: 'The length of the arrowhead portion.',+ description: 'The length of the arrowhead portion. Default 120.',},{name: 'shaftWidth',type: 'number',- description: 'The width of the arrow shaft.',+ description: 'The width of the arrow shaft. Default 80.',},{name: 'direction',type: '"left" | "right" | "up" | "down"',description: 'The direction the arrow points. Default right.',},- {- name: 'edgeRoundness',- type: 'number | null',- description:- 'Allows to modify the shape by rounding the edges using bezier curves. Default null.',- },{name: 'cornerRadius',type: 'number',description:- "Rounds the corner using an arc. Similar to CSS's border-radius. Cannot be used together with edgeRoundness.",+ "Rounds the corner using an arc. Similar to CSS's border-radius.",},],},@@ -360,8 +356,7 @@ export const ShapeOptions: React.FC<{);})}{all &&- (shapeComponent.shape === 'Arrow' ||- shapeComponent.shape === 'Rect' ||+ (shapeComponent.shape === 'Rect' ||shapeComponent.shape === 'Triangle' ||shapeComponent.shape === 'Polygon') ? (<>diff --git a/packages/docs/docs/shapes/arrow.mdx b/packages/docs/docs/shapes/arrow.mdxindex 51f9b878c7..7a96c363e3 100644--- a/packages/docs/docs/shapes/arrow.mdx+++ b/packages/docs/docs/shapes/arrow.mdx@@ -28,7 +28,7 @@ export const MyComposition = () => {alignItems: 'center',}}>- <Arrow length={200} headWidth={80} headLength={80} shaftWidth={40} fill="red" direction="right" />+ <Arrow length={300} headWidth={185} headLength={120} shaftWidth={80} fill="red" direction="right" /></AbsoluteFill>);};diff --git a/packages/docs/docs/shapes/make-arrow.mdx b/packages/docs/docs/shapes/make-arrow.mdxindex 8be71c6b95..d86519900d 100644--- a/packages/docs/docs/shapes/make-arrow.mdx+++ b/packages/docs/docs/shapes/make-arrow.mdx@@ -15,17 +15,12 @@ Generates an SVG path for an arrow shape.import {makeArrow} from '@remotion/shapes';const {path, width, height, transformOrigin} = makeArrow({- length: 200,- headWidth: 80,- headLength: 80,- shaftWidth: 40,+ length: 300,+ headWidth: 185,+ headLength: 120,+ shaftWidth: 80,direction: 'right',});--console.log(path); // M 0 20 L 120 20 L 120 0 L 200 40 L 120 80 L 120 60 L 0 60 L 0 20 Z-console.log(width); // 200-console.log(height); // 80-console.log(transformOrigin); // '100 40'```## Argumentsdiff --git a/packages/shapes/src/components/arrow.tsx b/packages/shapes/src/components/arrow.tsxindex 1c0b388682..aeaf472663 100644--- a/packages/shapes/src/components/arrow.tsx+++ b/packages/shapes/src/components/arrow.tsx@@ -8,13 +8,12 @@ export type ArrowProps = MakeArrowProps & AllShapesProps;/*** @description Renders an SVG element containing an arrow shape.- * @param {Number} length The total length of the arrow along its direction axis.- * @param {Number} headWidth The width of the arrowhead at its widest point.- * @param {Number} headLength The length of the arrowhead portion.- * @param {Number} shaftWidth The width of the arrow shaft.+ * @param {Number} length The total length of the arrow along its direction axis. Default 300.+ * @param {Number} headWidth The width of the arrowhead at its widest point. Default 185.+ * @param {Number} headLength The length of the arrowhead portion. Default 120.+ * @param {Number} shaftWidth The width of the arrow shaft. Default 80.* @param {string} direction The direction the arrow points. Default 'right'.- * @param {Number} cornerRadius Rounds the corner using an arc. Similar to CSS's border-radius. Cannot be used together with edgeRoundness.- * @param {null|Number} edgeRoundness Allows to modify the shape by rounding the edges using bezier curves. Default null.+ * @param {Number} cornerRadius Rounds the corner using an arc. Similar to CSS's border-radius.* @see [Documentation](https://www.remotion.dev/docs/shapes/arrow)*/export const Arrow: React.FC<ArrowProps> = ({@@ -24,7 +23,6 @@ export const Arrow: React.FC<ArrowProps> = ({shaftWidth,direction,cornerRadius,- edgeRoundness,...props}) => {return (@@ -36,7 +34,6 @@ export const Arrow: React.FC<ArrowProps> = ({shaftWidth,direction,cornerRadius,- edgeRoundness,})}{...props}/>diff --git a/packages/shapes/src/test/make-arrow.test.ts b/packages/shapes/src/test/make-arrow.test.tsindex 322c5c8c93..ff60521822 100644--- a/packages/shapes/src/test/make-arrow.test.ts+++ b/packages/shapes/src/test/make-arrow.test.ts@@ -155,18 +155,3 @@ test('Should be able to make an arrow with cornerRadius', () => {expect(arrow.instructions).toEqual(expect.any(Array));});-test('Should be able to make an arrow with edgeRoundness', () => {- const arrow = makeArrow({- length: 200,- headWidth: 80,- headLength: 80,- shaftWidth: 40,- edgeRoundness: 0.5,- });-- expect(arrow.width).toEqual(200);- expect(arrow.height).toEqual(80);- expect(arrow.transformOrigin).toEqual('100 40');- expect(arrow.path).toBeTruthy();- expect(arrow.instructions).toEqual(expect.any(Array));-});diff --git a/packages/shapes/src/utils/make-arrow.ts b/packages/shapes/src/utils/make-arrow.tsindex 36cfb3c435..d1c316a151 100644--- a/packages/shapes/src/utils/make-arrow.ts+++ b/packages/shapes/src/utils/make-arrow.ts@@ -6,34 +6,31 @@ import type {ShapeInfo} from './shape-info';type ArrowDirection = 'right' | 'left' | 'up' | 'down';export type MakeArrowProps = {- length: number;- headWidth: number;- headLength: number;- shaftWidth: number;+ length?: number;+ headWidth?: number;+ headLength?: number;+ shaftWidth?: number;direction?: ArrowDirection;- edgeRoundness?: number | null;cornerRadius?: number;};/*** @description Generates an SVG path for an arrow shape.- * @param {Number} length The total length of the arrow along its direction axis.- * @param {Number} headWidth The width of the arrowhead at its widest point.- * @param {Number} headLength The length of the arrowhead portion.- * @param {Number} shaftWidth The width of the arrow shaft.+ * @param {Number} length The total length of the arrow along its direction axis. Default 300.+ * @param {Number} headWidth The width of the arrowhead at its widest point. Default 185.+ * @param {Number} headLength The length of the arrowhead portion. Default 120.+ * @param {Number} shaftWidth The width of the arrow shaft. Default 80.* @param {string} direction The direction the arrow points. Default 'right'.- * @param {Number} cornerRadius Rounds the corner using an arc. Similar to CSS's border-radius. Cannot be used together with edgeRoundness.- * @param {null|Number} edgeRoundness Allows to modify the shape by rounding the edges using bezier curves. Default null.+ * @param {Number} cornerRadius Rounds the corner using an arc. Similar to CSS's border-radius.* @see [Documentation](https://www.remotion.dev/docs/shapes/make-arrow)*/export const makeArrow = ({- length,- headWidth,- headLength,- shaftWidth,+ length = 300,+ headWidth = 185,+ headLength = 120,+ shaftWidth = 80,direction = 'right',cornerRadius = 0,- edgeRoundness = null,}: MakeArrowProps): ShapeInfo => {if (length <= 0 || headWidth <= 0 || headLength <= 0 || shaftWidth <= 0) {throw new Error(@@ -111,7 +108,7 @@ export const makeArrow = ({const instructions: Instruction[] = [...joinPoints([...points, points[0]], {- edgeRoundness,+ edgeRoundness: null,cornerRadius,roundCornerStrategy: 'bezier',}),