> 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-ianimationchainanimatable/currentchainname.md).

# CurrentChainName

### Introduction

The CurrentChainName property gets and sets the name of the [AnimationChain](https://github.com/flatredball/FlatRedBallDocs/tree/main/frb/docs/index.php) currently played by the owner of the property. Setting this property is the most common way to change between different animations at runtime, and it can also be set in Glue to control the animation displayed by an IAnimationChainAnimatable (such as a [Sprite](https://github.com/flatredball/FlatRedBallDocs/tree/main/frb/docs/index.php)).

### Code Example

The CurrentChainName property is a string, so code can assign animation chains in a way that is not tied to the underlying content. The following code shows how to set the animation of an object according to [pressed keys](https://github.com/flatredball/FlatRedBallDocs/tree/main/frb/docs/index.php).

```
// Assuming that SpriteInstance is a valid Sprite, and that SpriteInstance contains animations with the name WalkLeft and WalkRight
if(InputManager.Keyboard.KeyDown(Keys.Right))
{
   SpriteInstance.CurrentChainName = "WalkRight";
}
else if(InputManager.Keyboard.KeyDown(Keys.Left))
{
   SpriteInstance.CurrentChainName = "WalkLeft";
}
```

### What does ChangingCurrentChainName do?

Changing CurrentChainName does a number of things:

* Sets the displayed animation to the animation matching the set name.
* Restarts the animation from the very beginning.
* Immediately updates the IAnimationChainAnimatable's textures and texture coordinates to reflect the first frame in the animation.

Note that these actions are only taken if the CurrentChainName \*changes. \*Assigning CurrentChainName to the same value performs no logic, so it can be safely set every frame without restarting the animation from the beginning. To restart the animation from the beginning, set [CurrentFrameIndex](/flatredball/api/flatredball/graphics/animation/flatredball-graphics-ianimationchainanimatable/currentframeindex.md) to 0.

### What does setting CurrentChainName not do?

Keep in mind that some properties will not change in response to CurrentChainName being set:

* JustCycled
* JustChangedFrame


---

# 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-ianimationchainanimatable/currentchainname.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.
