🎥 Make videos programmatically with React
don't reset path, will shift to top left with corner radius
Jonny Burger5a9e70e0bfe2
diff --git a/packages/shapes/src/test/polygon.test.tsx b/packages/shapes/src/test/polygon.test.tsxindex d2c0100390..111941c9bd 100644--- a/packages/shapes/src/test/polygon.test.tsx+++ b/packages/shapes/src/test/polygon.test.tsx@@ -5,21 +5,21 @@ import {render} from './test-utils';test('Should be able to make a triangle', () => {const {container} = render(<Polygon radius={100} points={3} />);expect(container.querySelector('path')?.getAttribute('d')).toEqual(- 'M 86.60254037844385 0 L 173.20508075688772 150 L 0 150.00000000000003 L 86.60254037844385 0',+ 'M 100 0 L 186.60254037844388 150 L 13.397459621556152 150.00000000000003 L 100 0',);});test('Should be able to make a pentagon', () => {const {container} = render(<Polygon radius={100} points={5} />);expect(container.querySelector('path')?.getAttribute('d')).toEqual(- 'M 95.10565162951536 0 L 190.21130325903073 69.09830056250526 L 153.8841768587627 180.90169943749476 L 36.327126400268064 180.90169943749476 L 0 69.09830056250527 L 95.10565162951536 0',+ 'M 100 0 L 195.10565162951536 69.09830056250526 L 158.77852522924732 180.90169943749476 L 41.2214747707527 180.90169943749476 L 4.894348370484636 69.09830056250527 L 100 0',);});test('Should be able to make a hexagon', () => {const {container} = render(<Polygon radius={100} points={6} />);expect(container.querySelector('path')?.getAttribute('d')).toEqual(- 'M 86.6025403784439 0 L 173.20508075688775 50 L 173.20508075688778 150 L 86.6025403784439 200 L 5.684341886080802e-14 150.00000000000003 L 0 50.000000000000064 L 86.6025403784439 0',+ 'M 100 0 L 186.60254037844385 50 L 186.60254037844388 150 L 100 200 L 13.397459621556152 150.00000000000003 L 13.397459621556095 50.000000000000064 L 100 0',);});diff --git a/packages/shapes/src/utils/make-polygon.ts b/packages/shapes/src/utils/make-polygon.tsindex aa0290951b..ca77e15bf7 100644--- a/packages/shapes/src/utils/make-polygon.ts+++ b/packages/shapes/src/utils/make-polygon.ts@@ -1,5 +1,5 @@import type {Instruction} from '@remotion/paths';-import {resetPath, serializeInstructions} from '@remotion/paths';+import {serializeInstructions} from '@remotion/paths';import {joinPoints} from './join-points';import type {ShapeInfo} from './shape-info';@@ -69,7 +69,7 @@ export const makePolygon = ({edgeRoundness,});return {- path: resetPath(serializeInstructions(polygonPathInstructions)),+ path: serializeInstructions(polygonPathInstructions),width,height,transformOrigin: `${centerX} ${centerY}`,