# 如何添加效果

你可以通过以下方式为文本添加效果：

### 为文本的特定部分设置效果 <a href="#set-effects-to-specific-parts-of-the-text" id="set-effects-to-specific-parts-of-the-text"></a>

你可以通过使用以下方式为文本的特定部分添加效果 **富文本标签。**

效果标签看起来会像这样：

* **持续**: `<tagID>` 用于打开， `</tagID>` 用于关闭
* **出现**: `{tagID}` 用于打开， `{/tagID}` 用于关闭
* **消失**: `{#tagID}` 用于打开， `{/#tagID}` 用于关闭\
  \&#xNAN;*（基本上就是一个出现标签，只是在前面加了一个 `#` ，只是为了提醒你，消失就是反向的出现）*.

{% embed url="<https://files.gitbook.com/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FXuXUTa2X5PYuYL6yRvl1%2Fuploads%2FsNWP4FirbP7rwT5nMSgN%2FTag_Example_TAnim3.0.mp4?alt=media&token=cbc0e61e-038a-4b3e-9116-432cf6ca6a94>" %}

#### 关于富文本格式的额外说明 <a href="#extra-notes-about-rich-text-formatting" id="extra-notes-about-rich-text-formatting"></a>

使用 TextAnimator for Unity 时：

* 你可以将多个效果叠加在一起（例如“`<shake><size>`”）。\
  （也请看看 [样式](/text-animator-unity/3.x-zh/zi-ding-yi/yang-shi.md))
* 你可以用一个‘ **全部** 当前已打开的效果，并通过一个‘`/`’字符关闭它们，例如：
  * ”`</>`” 用于持续效果
  * ”`{/}`” 用于出现效果
  * ”`{/#}`” 用于消失效果。
* 如果你在文本末尾，就没有必要关闭标签，因为 Text Animator 会从你打开标签的那一刻开始应用效果。（例如："`<shake>hello`" 会导致 hello 已经开始动画）。

{% embed url="<https://files.gitbook.com/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FXuXUTa2X5PYuYL6yRvl1%2Fuploads%2FBg3rDgfMUSYXWod3YRWa%2FStackEffects.mp4?alt=media&token=cb667514-8b82-40d2-b4ff-6450e652aa52>" %}

{% hint style="info" %}
要显示原始文本，请使用 `<noparse>` 标签来阻止 Text Animator 解析其他标签。
{% endhint %}

***

### 为整个文本设置默认效果 <a href="#set-default-effects-to-the-entire-text" id="set-default-effects-to-the-entire-text"></a>

你可以决定默认应用于所有字母的效果， **而无需在文本中写入效果标签** 这要感谢 [动画器设置](/text-animator-unity/3.x-zh/xiao-guo/ru-he-tian-jia-xiao-guo/dong-hua-qi-she-zhi.md).

{% tabs %}
{% tab title="UI 工具包" %}
AnimatedLabel 的设置通过不同的可脚本化对象进行管理（在这种情况下，就是下图中高亮显示的那个）。更多内容请在这里阅读： [如何创建一个](/text-animator-unity/3.x-zh/xiao-guo/ru-he-tian-jia-xiao-guo/dong-hua-qi-she-zhi.md).

{% hint style="success" %}
如果你没有设置一个，则会使用 [全局设置](/text-animator-unity/3.x-zh/zi-ding-yi/quan-ju-she-zhi.md) 中的那个！
{% endhint %}

<figure><img src="/files/a5f2795f395d3abab5eac083bc7c28d8f346eb4b" alt="" width="314"><figcaption></figcaption></figure>
{% endtab %}

{% tab title="Text Mesh Pro" %}
对于 Text Mesh Pro，设置可以是“本地的”（绑定到组件），也可以是“共享的”（在其他 Text Animator 实例之间共享）。

* 要修改 **本地化** 设置，只需前往“TextAnimator - Text Mesh Pro”组件检查器并调整它们的值。
* 要修改 **共享** 设置，请分配相应的 ScriptableObject 实例。 [在此阅读更多](/text-animator-unity/3.x-zh/xiao-guo/ru-he-tian-jia-xiao-guo/dong-hua-qi-she-zhi.md).
  {% endtab %}
  {% endtabs %}

在设置中：&#x20;

1. 访问“默认标签”部分
2. 展开你想编辑的效果类别
3. 添加你想包含的任何效果标签，例如：

<figure><img src="/files/2ee64321e766bec9d3d02396cd26c62d36da0b6d" alt="" width="362"><figcaption></figcaption></figure>

{% hint style="info" %}
&#x20;如果你不想默认应用任何效果，只需将效果数量设为零。
{% endhint %}

{% hint style="success" %}
你也可以将“**默认标签模式**”改为“**常量**”，如果你希望效果一直应用，并叠加在所有内容之上。
{% endhint %}

{% hint style="success" %}
你可以给每个数组元素添加修饰符，比如“shake a=5”，更多内容请阅读这里： [修饰符](/text-animator-unity/3.x-zh/xiao-guo/ru-he-bian-ji-xiao-guo/xiu-shi-fu.md)
{% endhint %}

<details>

<summary>示例：回退</summary>

假设我们有一个默认效果（“size”），但我们想用“fade”效果来应用文本的特定部分。\
我们可以通过写出："default default \`{fade}\` fade fade fade \`{/fade}\` default default" 来实现这个结果

![](/files/7ae6c43e11320b9196ff39b9b97de3e32c65776b)

如你所见，位于“fade”标签之外的字母将应用默认效果，而位于“{fade}”和“{/fade}”之间的部分只会应用“fade”。

</details>


---

# 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.febucci.com/text-animator-unity/3.x-zh/xiao-guo/ru-he-tian-jia-xiao-guo.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.
