# Changing Text Mid-Animation

By default animated text elements reset their animation whenever you change the value of `.text` . To create a continuous animation while changing text it's possible to use the `SetTime()` function to manually manage the animation progress.

### Example

The following script pauses the text element, which keeps it from advancing the internal timer on its own, then it manually sets the time each frame.

```csharp
using TextAnimationsForUIToolkit;
using UnityEngine;
using UnityEngine.UIElements;

public class ChangeTextMidAnimation : MonoBehaviour
{
    public UIDocument uiDocument;

    private IAnimatedTextElement _element;
    private float _startTime;

    private void Start()
    {
        _element = TextAnimationUtility.GetAnimatedTextElement(uiDocument, "animated-timer");

        // Stop the visual element from automatically advancing time
        _element.Pause();
        _startTime = Time.time;
    }

    private void Update()
    {
        var currentTime = Time.time - _startTime;
        _element.text = $"<wave>Timer: {currentTime:F}</wave>";
        _element.SetTime(currentTime);
    }
}
```

{% hint style="warning" %}
Note that using `.SetTime` to manually manage an animation currently does not support [Events](/text-animations/events/events.md). If you need both of these features combined, please contact me via the [contact form](https://stixgames.com/contact/), or join my [Discord](https://discord.gg/jvBFhQA)!
{% endhint %}


---

# Agent Instructions: Querying This Documentation

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

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.stixgames.com/text-animations/animations/changing-text-mid-animation.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
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.
