🎥 Make videos programmatically with React
reduceInstructions()
Jonny Burger48d2b2d56178
diff --git a/packages/docs/docs/paths/simplify-instructions.md b/packages/docs/docs/paths/simplify-instructions.mdindex b12f2acb73..df46dc8150 100644--- a/packages/docs/docs/paths/simplify-instructions.md+++ b/packages/docs/docs/paths/simplify-instructions.md@@ -1,5 +1,5 @@----title: simplifyInstructions()+title: reduceInstructions()crumb: "@remotion/paths"---@@ -11,9 +11,9 @@ This is useful if you want to manually edit a path and want to make sure it's asNote that this may result in a longer path.```ts twoslash-import { simplifyInstructions } from "@remotion/paths";+import { reduceInstructions } from "@remotion/paths";-const simplified = simplifyInstructions([+const simplified = reduceInstructions([{ type: "m", dx: 10, dy: 10 },{ type: "h", dx: 100 },]);@@ -30,4 +30,4 @@ const simplified = simplifyInstructions([- [`@remotion/paths`](/docs/paths)- [`parsePath()`](/docs/paths/parse-path)-- [Source code for this function](https://github.com/remotion-dev/remotion/blob/main/packages/paths/src/simplify-instructions.ts)+- [Source code for this function](https://github.com/remotion-dev/remotion/blob/main/packages/paths/src/reduce-instructions.ts)diff --git a/packages/docs/sidebars.js b/packages/docs/sidebars.jsindex fbcacf7eab..3b633b3372 100644--- a/packages/docs/sidebars.js+++ b/packages/docs/sidebars.js@@ -266,7 +266,7 @@ module.exports = {"paths/extend-viewbox","paths/parse-path","paths/serialize-instructions",- "paths/simplify-instructions",+ "paths/reduce-instructions","paths/get-parts",],},diff --git a/packages/paths/src/index.ts b/packages/paths/src/index.tsindex 1b08f64c07..a267cb2bdd 100644--- a/packages/paths/src/index.ts+++ b/packages/paths/src/index.ts@@ -16,8 +16,8 @@ export {export {interpolatePath} from './interpolate-path';export {normalizePath} from './normalize-path';export {parsePath} from './parse-path';+export {reduceInstructions} from './reduce-instructions';export {resetPath} from './reset-path';export {reversePath} from './reverse-path';export {serializeInstructions} from './serialize-instructions';-export {simplifyInstructions} from './simplify-instructions';export {translatePath} from './translate-path';diff --git a/packages/paths/src/simplify-instructions.ts b/packages/paths/src/simplify-instructions.tsindex 19b011187d..eff4b7841c 100644--- a/packages/paths/src/simplify-instructions.ts+++ b/packages/paths/src/simplify-instructions.ts@@ -2,7 +2,7 @@ import {removeATSHVInstructions} from './helpers/remove-a-s-t-curves';import type {Instruction, ReducedInstruction} from './helpers/types';import {normalizeInstructions} from './normalize-path';-export const simplifyInstructions = (+export const reduceInstructions = (instruction: Instruction[]): ReducedInstruction[] => {const simplified = normalizeInstructions(instruction);diff --git a/packages/paths/src/test/simplify-instructions.test.ts b/packages/paths/src/test/simplify-instructions.test.tsindex f570f34ca2..7bec0984ac 100644--- a/packages/paths/src/test/simplify-instructions.test.ts+++ b/packages/paths/src/test/simplify-instructions.test.ts@@ -1,8 +1,8 @@import {expect, test} from 'vitest';-import {simplifyInstructions} from '..';+import {reduceInstructions} from '..';test('Should simplify simple instructions', () => {- const simplified = simplifyInstructions([+ const simplified = reduceInstructions([{type: 'm', dx: 10, dy: 10},{type: 'h', dx: 100},]);@@ -14,7 +14,7 @@ test('Should simplify simple instructions', () => {});test('Should reduce A instructions', () => {- const simplified = simplifyInstructions([+ const simplified = reduceInstructions([{type: 'A',largeArcFlag: true,