> For the complete documentation index, see [llms.txt](https://docs.flatredball.com/flatredball/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.flatredball.com/flatredball/api/flatredball/graphics/animation/flatredball-graphics-animationchain.md).

# AnimationChain

### Introduction

AnimationChains represent a series of [AnimationFrames](/flatredball/api/flatredball/graphics/animation/flatredball-graphics-animationframe.md) which can be used to animate objects which implement the [IAnimationChainAnimatable](/flatredball/api/flatredball/graphics/animation/flatredball-graphics-ianimationchainanimatable.md) interface such as [Sprites](/flatredball/api/flatredball/sprite.md). AnimationChains can be created in code, or they can be created using the [AnimationEditor](/flatredball/glue-gluevault-component-pages-animationeditor-plugin.md). The AnimationEditor is installed when running the FlatRedBall installer which can be found on the [downloads page](/flatredball/readme.md). The IAnimationChainAnimatable page has more information on how to use AnimationChains, so please check it out after finishing up this page.

### Namespace

The following statement will help reduce code when working with AnimationChains.

```csharp
using FlatRedBall.Graphics.Animation;
```

### Creating AnimationChains

AnimationChains can be created manually by creating the frames individually through code, by loading a .achx file, or through the content pipeline.

#### Creating AnimationChains in Code

```csharp
AnimationChain animationChain = new AnimationChain();
animationChain.Add(new AnimationFrame(@"Animation\Drone_0000.png", .1f, "Global"));
animationChain.Add(new AnimationFrame(@"Animation\Drone_0001.png", .1f, "Global"));
animationChain.Add(new AnimationFrame(@"Animation\Drone_0002.png", .1f, "Global"));
animationChain.Add(new AnimationFrame(@"Animation\Drone_0003.png", .1f, "Global"));
animationChain.Add(new AnimationFrame(@"Animation\Drone_0004.png", .1f, "Global"));
animationChain.Add(new AnimationFrame(@"Animation\Drone_0005.png", .1f, "Global"));
animationChain.Add(new AnimationFrame(@"Animation\Drone_0006.png", .1f, "Global"));
animationChain.Add(new AnimationFrame(@"Animation\Drone_0007.png", .1f, "Global"));
animationChain.Add(new AnimationFrame(@"Animation\Drone_0008.png", .1f, "Global"));
animationChain.Add(new AnimationFrame(@"Animation\Drone_0009.png", .1f, "Global"));
animationChain.Add(new AnimationFrame(@"Animation\Drone_0010.png", .1f, "Global"));
```

Notice that the .1f is the frame length in seconds. For information on loading an Animation from-file loading, see the [AnimationChainList](/flatredball/api/flatredball/graphics/animation/flatredball-graphics-animationchainlist.md) page.

Note: The AnimationFrame class is used to define individual frames in an AnimationChain. For more information on how to modify your animations, including how to create animations by using parts of a single Texture, see the [AnimationFrame page](/flatredball/api/flatredball/graphics/animation/flatredball-graphics-animationframe.md).

#### Loading an AnimationChainList from file

For information on loading an AnimationChainList from a .achx file, see [this page](https://github.com/flatredball/FlatRedBallDocs/tree/main/frb/docs/index.php#Loading_from_file).

### Accessing AnimationFrames

AnimationChains are also Lists of AnimationFrames. Therefore the AnimationChain provides the same interface as a list for accessing frames, such as indexing ( \[index] ), properties like Count, and methods like Add. For example, the following code can be used to change the referenced texture of all frames in an animation chain to NewTexture :

```csharp
foreach(var frame in AnimationChainInstance)
{
   frame.Texture = NewTexture;
}
```


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.flatredball.com/flatredball/api/flatredball/graphics/animation/flatredball-graphics-animationchain.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
