Skip to main content

duplicateEffects()v4.0.528

Copies selected effects immediately after their originals.

warning

Draft API: This API is experimental and may change.

duplicate-effects.ts
import {duplicateEffects, type CodemodProject, type EffectReference} from '@remotion/codemods'; declare const project: CodemodProject; declare const effect: EffectReference; const result = await duplicateEffects({ project, effects: [effect], }); console.log(result);

Copies effect configuration expressions, including animations. Existing effect indices may shift; inspect the updated source before reusing other effect references.

Options​

project​

An in-memory CodemodProject. The input project is not mutated.

effects​

Effect references to duplicate. References may span files and nodes; indices refer to the input project. Duplicate references are deduplicated.

Return value​

A promise resolving to an object with the following properties.

changes​

An array of {filePath, previousContents, nextContents} file changes. A null content value indicates a created or deleted file.

nodePathRemappings​

An array of {filePath, oldNodePath, newNodePath} mappings. A null old path indicates an insertion; a null new path indicates removal. Apply these mappings to references from the input project. See node references.

insertedEffects​

References to the copies, with indices in the updated effects arrays.

Errors​

Throws or rejects when the target cannot be resolved, the requested edit is unsupported, or an option is invalid. Failed edits leave the input project unchanged.

Compatibility​

BrowsersServersEnvironments
Chrome
Firefox
Safari
Node.js
Bun
Serverless Functions

See also​