# AnimationCodec

Version: 0.5.0
Framework commit: d503df2befa756e681fcdc6250e9552dc7388bea
Canonical URL: /docs/0.5.0/api/ferroui-designer-animation/trait-animationcodec/

**trait** · [`ferroui-designer-animation`](/docs/0.5.0/api/ferroui-designer-animation/) · v0.5.0

```rust
trait AnimationCodec
```

A custom codec owns the complete payload it recognizes. `encode` receives the original
source, allowing a plugin to retain custom animator configuration while changing keyframes.
An unsuccessful decode never changes the document or removes the opaque program.

[View source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Designer.Animation/programs.rs#L39)

## Members

- [`id`](#function-id)
- [`can_decode`](#function-can_decode)
- [`decode`](#function-decode)
- [`encode`](#function-encode)

<a id="function-id"></a>

### id

```rust
fn id(self: &Self) -> &str
```



[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Designer.Animation/programs.rs#L40)

<a id="function-can_decode"></a>

### can_decode

```rust
fn can_decode(self: &Self, source: &str) -> bool
```



[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Designer.Animation/programs.rs#L41)

<a id="function-decode"></a>

### decode

```rust
fn decode(self: &Self, source: &str, target: NodeId, options: &ImportOptions) -> Result<AnimationImport>
```



[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Designer.Animation/programs.rs#L42)

<a id="function-encode"></a>

### encode

```rust
fn encode(self: &Self, original: &str, timeline: &Timeline, target: NodeId) -> Result<String>
```



[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Designer.Animation/programs.rs#L48)

## Availability

Extracted for `aarch64-apple-darwin`. Cargo features are listed in the [crate index](/docs/0.5.0/api/).
