pasteEffects()v4.0.544
Copies effect descriptions onto a node, adding their imports and animation helpers.
Draft API: This API is experimental and may change.
paste-effects.tsimport {pasteEffects , typeCodemodProject , typeNodeReference } from '@remotion/codemods'; declare constproject :CodemodProject ; declare constnode :NodeReference ; constresult =pasteEffects ({project ,node ,effects : [{callee : 'blur',importPath : '@remotion/effects/blur',params : {radius : {type : 'static',value : 12}}}],mode : 'append', });console .log (result .changes );
Options
project
An in-memory CodemodProject.
node
The target NodeReference.
effects
An array of PasteEffect descriptions. It must be nonempty unless mode is 'replace'.
callee
The effect's exported function name.
importPath
The module exporting the effect.
params
A record of parameter descriptions. A static parameter has the shape {type: 'static', value}. Keyframed parameters use {type: 'keyframed', interpolationFunction, keyframes, easing, clamping, output, posterize} and preserve their animation when pasted.
mode?
'append' adds to the existing inline array. 'replace' replaces it, or removes the effects attribute when effects is empty. Defaults to 'append'.
insertAtIndices?
Insertion positions for the effects, in input order. Positions are applied in ascending order and clamped to the current array length. Must contain one distinct nonnegative integer per effect. Available with 'append' only. Defaults to null, which appends the effects.
prettierConfigOverride?
Formatting options for generated source. Defaults to null, which follows the existing source style.
Return value
An object with the following properties.
changes
File changes to apply with applyCodemodChanges(). The input project is not mutated.
nodePathRemappings
Mappings from the original node paths to their new paths. See node references.
insertedEffects
References to the pasted effects, in input order.
updatedNode
The destination node's reference after the edit.
editDetails
The file path, formatting status, effect labels and source line.
Errors
Throws when the target cannot be resolved or the requested edit is invalid. Failed edits leave the input project unchanged.
Compatibility
| Browsers | Servers | Environments | |||||||
|---|---|---|---|---|---|---|---|---|---|
Chrome | Firefox | Safari | Node.js | Bun | Serverless Functions | ||||