## DuIO.Animation

Animation IO

View Source DuAEF_Duik_api.jsxinc, line 31938

# Methods

#### # static cleanExportData(data) → {object}

Cleans data from an After Effects animation before exporting it.
This is a low-level function which you may need only if building your own export formats.
It cleans the data returned by the "getAnim" functions (see `DuAELayer.getAnim`, `DuAELayer.getAnims`, `DuAEProperty.getAnim`) to be able to store it in a text file.

##### Parameters:

Name | Type | Description
--- | --- | ---
`data` | `object` | The animation

View Source DuAEF_Duik_api.jsxinc, line 32109

Returns:
The data cleaned
Type: `object`

#### # static cleanImportData(data) → {object}

Cleans data from a JSON before loading it.
This is a low-level function which you may need only if building your own import formats.
It cleans the data stored after having used `DuAEF.Interchange.animation.cleanAnimExportData`
to be able to set the animations using the "setAnim" functions (see `DuAEF.DuAE.Layer.setAnim`, `DuAEF.DuAE.Property.setAnim`).

##### Parameters:

Name | Type | Description
--- | --- | ---
`data` | `object` | The animation

View Source DuAEF_Duik_api.jsxinc, line 32146

Returns:
The data cleaned
Type: `object`

#### # static fromJson(jsonFile, layersopt, keyframesOnlyopt, matchNamesopt, offsetopt, reverseopt)

Loads an animation file and applies it on the layers

##### Parameters:

Name | Type | Attributes | Default | Description
--- | --- | --- | --- | ---
`jsonFile` | `File` |  |  | The file containing the animation
`layers` | `Array.<Layer>` | `DuList.<Layer>` | `LayerCollection` | <optional> |  | The layers. If omitted, will get the selected layers from the current comp, or all layers if none are selected.
`keyframesOnly` | `Boolean` | <optional> | false | If true, will load only keyframes, but not static values or expressions.
`matchNames` | `Array.<string>` | <optional> | [] | A filter for the properties to load. If empty, will load all properties.
`offset` | `Boolean` | <optional> | false | Whether to offset the current values or use absolute values.
`reverse` | `Boolean` | <optional> | false | Whether to reverse the keyframes in time.

View Source DuAEF_Duik_api.jsxinc, line 32081

#### # static keyframeInterpolationTypeToName(type) → {string}

Gets the name of an After Effects interpolation type.
This is a low-level function which you should not need.
It used by `DuIO.Animation.cleanAnimExportData` to store interpolation with their names.

##### Parameters:

Name | Type | Description
--- | --- | ---
`type` | `KeyframeInterpolationType` | The After Effects interpolation type

View Source DuAEF_Duik_api.jsxinc, line 32229

Returns:
The interpolation name or empty string if not found
Type: `string`

#### # static paste(data, compopt, replaceopt, offsetopt, reverseopt, matchNamesopt, keyframesOnlyopt, expressionsopt, dontMoveAncestorsopt)

Pastes the animation previously copied by `Duik.Animation.copy` to the selected properties.

##### Parameters:

Name | Type | Attributes | Default | Description
--- | --- | --- | --- | ---
`data` | `Array.<DuAELayerAnimation>` |  |  | The animation data to paste
`comp` | `CompItem` | <optional> |  | The composition.
`replace` | `Boolean` | <optional> | false | Whether to completely erase and replace the current animation
`offset` | `Boolean` | <optional> | false | Whether to offset the animation from the current value
`reverse` | `Boolean` | <optional> | false | Whether to reverse the animation
`matchNames` | `Array.<string>` | <optional> | [] | A filter to apply only on specific property types
`keyframesOnly` | `Boolean` | <optional> | true | If false, the value of properties without keyframes will be set too.
`expressions` | `Boolean` | <optional> | false | If true, the expression is set too.
`dontMoveAncestors` | `Boolean` | <optional> | false | When set to true, the transform (position, rotation) values for ancestor layers (the ones without parent) will be offset to 0 before applying the animation.

View Source DuAEF_Duik_api.jsxinc, line 31953

#### # static toJson(file, layersopt, selectedKeysOnlyopt) → {Array.<DuAELayerAnimation>}

Copies all the animations on selected layers, and saves them to a Json file.

##### Parameters:

Name | Type | Attributes | Description
--- | --- | --- | ---
`file` | `File` |  | The file to save the data
`layers` | `Array.<Layer>` | `DuList.<Layer>` | `LayerCollection` | <optional> | An array of Layers or LayerCollection with the animation. Selected layers from the current comp if omitted.
`selectedKeysOnly` | `Boolean` | <optional> | Wether to copy only selected keys or not. If omitted, will be true if there are selected keyframes, false otherwise.

View Source DuAEF_Duik_api.jsxinc, line 32038

Returns:
The animations
Type: `Array.<DuAELayerAnimation>`